[Settings] Avoids disabled component when page start from setup wizard.
Fixs when disable component during system busy, the framework have high possibility to force closing activities on the same task. test 1. setup a pin code and go through to the anything else page. click "control info on lock screen". >> The SetupRedactionInterstitial not been disabled. >> The lock screen can be setup repeatedly. 2. into home screen. using adb command to start SetupRedactionInterstitial. >> the screen not shown. 3. using adb command to start RedactionInterstitial and click "done". >> the activity existed normally. Bug: 158961310 Test: Manual Change-Id: I09fe95db591d3d3603b2c13623a0873bfab3bac0
This commit is contained in:
@@ -20,9 +20,12 @@ import android.content.ComponentName;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
|
import android.os.Bundle;
|
||||||
|
|
||||||
import com.android.settings.notification.RedactionInterstitial;
|
import com.android.settings.notification.RedactionInterstitial;
|
||||||
|
|
||||||
|
import com.google.android.setupcompat.util.WizardManagerHelper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Setup Wizard's version of RedactionInterstitial screen. It inherits the logic and basic structure
|
* Setup Wizard's version of RedactionInterstitial screen. It inherits the logic and basic structure
|
||||||
* from RedactionInterstitial class, and should remain similar to that behaviorally. This class
|
* from RedactionInterstitial class, and should remain similar to that behaviorally. This class
|
||||||
@@ -46,6 +49,15 @@ public class SetupRedactionInterstitial extends RedactionInterstitial {
|
|||||||
PackageManager.DONT_KILL_APP);
|
PackageManager.DONT_KILL_APP);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstance) {
|
||||||
|
// Only allow to start the activity from Setup Wizard.
|
||||||
|
if (!WizardManagerHelper.isAnySetupWizard(getIntent())) {
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
super.onCreate(savedInstance);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Intent getIntent() {
|
public Intent getIntent() {
|
||||||
Intent modIntent = new Intent(super.getIntent());
|
Intent modIntent = new Intent(super.getIntent());
|
||||||
|
@@ -48,6 +48,7 @@ import com.android.settingslib.RestrictedLockUtilsInternal;
|
|||||||
|
|
||||||
import com.google.android.setupcompat.template.FooterBarMixin;
|
import com.google.android.setupcompat.template.FooterBarMixin;
|
||||||
import com.google.android.setupcompat.template.FooterButton;
|
import com.google.android.setupcompat.template.FooterButton;
|
||||||
|
import com.google.android.setupcompat.util.WizardManagerHelper;
|
||||||
import com.google.android.setupdesign.GlifLayout;
|
import com.google.android.setupdesign.GlifLayout;
|
||||||
|
|
||||||
public class RedactionInterstitial extends SettingsActivity {
|
public class RedactionInterstitial extends SettingsActivity {
|
||||||
@@ -144,7 +145,11 @@ public class RedactionInterstitial extends SettingsActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void onDoneButtonClicked(View view) {
|
private void onDoneButtonClicked(View view) {
|
||||||
SetupRedactionInterstitial.setEnabled(getContext(), false);
|
// If the activity starts by Setup Wizard, then skip disable component which avoids the
|
||||||
|
// framework force closing all activities on the same task when the system is busy.
|
||||||
|
if (!WizardManagerHelper.isAnySetupWizard(getIntent())) {
|
||||||
|
SetupRedactionInterstitial.setEnabled(getContext(), false);
|
||||||
|
}
|
||||||
final RedactionInterstitial activity = (RedactionInterstitial) getActivity();
|
final RedactionInterstitial activity = (RedactionInterstitial) getActivity();
|
||||||
if (activity != null) {
|
if (activity != null) {
|
||||||
activity.setResult(RESULT_OK, null);
|
activity.setResult(RESULT_OK, null);
|
||||||
|
Reference in New Issue
Block a user