Merge "Sometime, Settings app crash when AllowBindAppWidgetActivity closing"
This commit is contained in:
@@ -51,9 +51,8 @@ public class AllowBindAppWidgetActivity extends AlertActivity implements
|
|||||||
private boolean mClicked;
|
private boolean mClicked;
|
||||||
|
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
|
mClicked = true;
|
||||||
if (which == AlertDialog.BUTTON_POSITIVE) {
|
if (which == AlertDialog.BUTTON_POSITIVE) {
|
||||||
// By default, set the result to cancelled
|
|
||||||
setResult(RESULT_CANCELED);
|
|
||||||
if (mAppWidgetId != -1 && mComponentName != null && mCallingPackage != null) {
|
if (mAppWidgetId != -1 && mComponentName != null && mCallingPackage != null) {
|
||||||
try {
|
try {
|
||||||
final boolean bound = mAppWidgetManager.bindAppWidgetIdIfAllowed(mAppWidgetId,
|
final boolean bound = mAppWidgetManager.bindAppWidgetIdIfAllowed(mAppWidgetId,
|
||||||
@@ -79,15 +78,18 @@ public class AllowBindAppWidgetActivity extends AlertActivity implements
|
|||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
protected void onPause() {
|
protected void onPause() {
|
||||||
if (isDestroyed() && !mClicked) {
|
if (!mClicked) { // RESULT_CANCELED
|
||||||
setResult(RESULT_CANCELED);
|
finish();
|
||||||
}
|
}
|
||||||
super.onDestroy();
|
super.onPause();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
setResult(RESULT_CANCELED); // By default, set the result to cancelled
|
||||||
Intent intent = getIntent();
|
Intent intent = getIntent();
|
||||||
CharSequence label = "";
|
CharSequence label = "";
|
||||||
if (intent != null) {
|
if (intent != null) {
|
||||||
@@ -109,7 +111,6 @@ public class AllowBindAppWidgetActivity extends AlertActivity implements
|
|||||||
mComponentName = null;
|
mComponentName = null;
|
||||||
mCallingPackage = null;
|
mCallingPackage = null;
|
||||||
Log.v("BIND_APPWIDGET", "Error getting parameters");
|
Log.v("BIND_APPWIDGET", "Error getting parameters");
|
||||||
setResult(RESULT_CANCELED);
|
|
||||||
finish();
|
finish();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user