|
|
@ -62,18 +62,22 @@ public class MainActivity extends AppCompatActivity {
|
|
|
|
static {
|
|
|
|
static {
|
|
|
|
System.loadLibrary("microphoto");
|
|
|
|
System.loadLibrary("microphoto");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private ActivityMainBinding binding;
|
|
|
|
private ActivityMainBinding binding;
|
|
|
|
private int defaultDataSubId;
|
|
|
|
private int defaultDataSubId;
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
protected void onDestroy() {
|
|
|
|
protected void onDestroy() {
|
|
|
|
super.onDestroy();
|
|
|
|
super.onDestroy();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
protected class AppConfig {
|
|
|
|
protected class AppConfig {
|
|
|
|
public String cmdid;
|
|
|
|
public String cmdid;
|
|
|
|
public String server;
|
|
|
|
public String server;
|
|
|
|
public int port;
|
|
|
|
public int port;
|
|
|
|
public int protocol;
|
|
|
|
public int protocol;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
protected void onCreate(Bundle savedInstanceState) {
|
|
|
|
protected void onCreate(Bundle savedInstanceState) {
|
|
|
|
super.onCreate(savedInstanceState);
|
|
|
|
super.onCreate(savedInstanceState);
|
|
|
@ -102,14 +106,9 @@ public class MainActivity extends AppCompatActivity {
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void onClick(View view) {
|
|
|
|
public void onClick(View view) {
|
|
|
|
|
|
|
|
|
|
|
|
String[] accessPermissions = new String[]{
|
|
|
|
String[] accessPermissions = new String[]{Manifest.permission.CAMERA, Manifest.permission.WRITE_EXTERNAL_STORAGE, Manifest.permission.FOREGROUND_SERVICE, Manifest.permission.READ_PHONE_STATE,
|
|
|
|
Manifest.permission.CAMERA,
|
|
|
|
|
|
|
|
Manifest.permission.WRITE_EXTERNAL_STORAGE,
|
|
|
|
|
|
|
|
Manifest.permission.FOREGROUND_SERVICE,
|
|
|
|
|
|
|
|
Manifest.permission.READ_PHONE_STATE,
|
|
|
|
|
|
|
|
/*Manifest.permission.PACKAGE_USAGE_STATS,*/
|
|
|
|
/*Manifest.permission.PACKAGE_USAGE_STATS,*/
|
|
|
|
/*Manifest.permission.SET_TIME,*/
|
|
|
|
/*Manifest.permission.SET_TIME,*/};
|
|
|
|
};
|
|
|
|
|
|
|
|
boolean needRequire = false;
|
|
|
|
boolean needRequire = false;
|
|
|
|
for (String access : accessPermissions) {
|
|
|
|
for (String access : accessPermissions) {
|
|
|
|
int curPermission = ActivityCompat.checkSelfPermission(MainActivity.this, access);
|
|
|
|
int curPermission = ActivityCompat.checkSelfPermission(MainActivity.this, access);
|
|
|
@ -119,10 +118,7 @@ public class MainActivity extends AppCompatActivity {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (needRequire) {
|
|
|
|
if (needRequire) {
|
|
|
|
ActivityCompat.requestPermissions(
|
|
|
|
ActivityCompat.requestPermissions(MainActivity.this, accessPermissions, MY_PERMISSIONS_REQUEST_FOREGROUND_SERVICE);
|
|
|
|
MainActivity.this,
|
|
|
|
|
|
|
|
accessPermissions,
|
|
|
|
|
|
|
|
MY_PERMISSIONS_REQUEST_FOREGROUND_SERVICE);
|
|
|
|
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -377,8 +373,7 @@ public class MainActivity extends AppCompatActivity {
|
|
|
|
e.printStackTrace();
|
|
|
|
e.printStackTrace();
|
|
|
|
} catch (JSONException e) {
|
|
|
|
} catch (JSONException e) {
|
|
|
|
e.printStackTrace();
|
|
|
|
e.printStackTrace();
|
|
|
|
}
|
|
|
|
} finally {
|
|
|
|
finally {
|
|
|
|
|
|
|
|
if (inputStreamReader != null) {
|
|
|
|
if (inputStreamReader != null) {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
inputStreamReader.close();
|
|
|
|
inputStreamReader.close();
|
|
|
@ -412,8 +407,7 @@ public class MainActivity extends AppCompatActivity {
|
|
|
|
e.printStackTrace();
|
|
|
|
e.printStackTrace();
|
|
|
|
} catch (JSONException e) {
|
|
|
|
} catch (JSONException e) {
|
|
|
|
e.printStackTrace();
|
|
|
|
e.printStackTrace();
|
|
|
|
}
|
|
|
|
} finally {
|
|
|
|
finally {
|
|
|
|
|
|
|
|
if (outputStreamWriter != null) {
|
|
|
|
if (outputStreamWriter != null) {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
outputStreamWriter.close();
|
|
|
|
outputStreamWriter.close();
|
|
|
|