android: Guard aganst ANRs harder?
All checks were successful
Build Tilde Friends / Build-All (push) Successful in 31m26s
All checks were successful
Build Tilde Friends / Build-All (push) Successful in 31m26s
This commit is contained in:
@@ -50,6 +50,7 @@ public class TildeFriendsActivity extends Activity {
|
||||
TildeFriendsWebView web_view;
|
||||
String base_url;
|
||||
String port_file_path;
|
||||
Thread create_thread;
|
||||
Thread server_thread;
|
||||
ServiceConnection service_connection;
|
||||
FileObserver observer;
|
||||
@@ -67,17 +68,7 @@ public class TildeFriendsActivity extends Activity {
|
||||
public static native int tf_server_main(String files_dir, String apk_path, String out_port_file_path, ConnectivityManager connectivity_manager);
|
||||
public static native int tf_sandbox_main(int pipe_fd);
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
s_activity = this;
|
||||
StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder()
|
||||
.detectLeakedClosableObjects()
|
||||
.penaltyLog()
|
||||
.build());
|
||||
super.onCreate(savedInstanceState);
|
||||
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||
setContentView(R.layout.activity_main);
|
||||
|
||||
private void createThread() {
|
||||
web_view = (TildeFriendsWebView)findViewById(R.id.web);
|
||||
set_status("Extracting executable...");
|
||||
Log.w("tildefriends", String.format("getFilesDir() is %s", getFilesDir().toString()));
|
||||
@@ -109,6 +100,7 @@ public class TildeFriendsActivity extends Activity {
|
||||
});
|
||||
server_thread.start();
|
||||
|
||||
runOnUiThread(() -> {
|
||||
web_view.getSettings().setJavaScriptEnabled(true);
|
||||
web_view.getSettings().setDomStorageEnabled(true);
|
||||
|
||||
@@ -251,10 +243,41 @@ public class TildeFriendsActivity extends Activity {
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
s_activity.create_thread = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
s_activity = this;
|
||||
super.onCreate(savedInstanceState);
|
||||
StrictMode.setThreadPolicy(
|
||||
new StrictMode.ThreadPolicy.Builder()
|
||||
.detectAll()
|
||||
.penaltyDialog()
|
||||
.penaltyLog()
|
||||
.build());
|
||||
StrictMode.setVmPolicy(
|
||||
new StrictMode.VmPolicy.Builder()
|
||||
.detectLeakedClosableObjects()
|
||||
.detectAll()
|
||||
.penaltyLog()
|
||||
.build());
|
||||
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||
|
||||
setContentView(R.layout.activity_main);
|
||||
TextView refresh = (TextView)findViewById(R.id.refresh);
|
||||
refresh.setVisibility(View.GONE);
|
||||
refresh.setText("REFRESH");
|
||||
|
||||
create_thread = new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
s_activity.createThread();
|
||||
}
|
||||
});
|
||||
create_thread.start();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Reference in New Issue
Block a user