Prevents drawer menu from showing depending on intent.
When ChooseLockScreenGeneric is started via the set password intents, it should not allow the drawer menu to show. bug:26288300 Change-Id: I10d512e20fedab2be8c725c7d524db0c55666590
This commit is contained in:
@@ -59,6 +59,12 @@ public class ChooseLockGeneric extends SettingsActivity {
|
|||||||
public Intent getIntent() {
|
public Intent getIntent() {
|
||||||
Intent modIntent = new Intent(super.getIntent());
|
Intent modIntent = new Intent(super.getIntent());
|
||||||
modIntent.putExtra(EXTRA_SHOW_FRAGMENT, getFragmentClass().getName());
|
modIntent.putExtra(EXTRA_SHOW_FRAGMENT, getFragmentClass().getName());
|
||||||
|
|
||||||
|
String action = modIntent.getAction();
|
||||||
|
if (DevicePolicyManager.ACTION_SET_NEW_PASSWORD.equals(action)
|
||||||
|
|| DevicePolicyManager.ACTION_SET_NEW_PARENT_PROFILE_PASSWORD.equals(action)) {
|
||||||
|
modIntent.putExtra(EXTRA_HIDE_DRAWER, true);
|
||||||
|
}
|
||||||
return modIntent;
|
return modIntent;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -110,6 +116,7 @@ public class ChooseLockGeneric extends SettingsActivity {
|
|||||||
private LockPatternUtils mLockPatternUtils;
|
private LockPatternUtils mLockPatternUtils;
|
||||||
private FingerprintManager mFingerprintManager;
|
private FingerprintManager mFingerprintManager;
|
||||||
private int mUserId;
|
private int mUserId;
|
||||||
|
private boolean mHideDrawer = false;
|
||||||
private RemovalCallback mRemovalCallback = new RemovalCallback() {
|
private RemovalCallback mRemovalCallback = new RemovalCallback() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -154,6 +161,7 @@ public class ChooseLockGeneric extends SettingsActivity {
|
|||||||
if (getActivity() instanceof ChooseLockGeneric.InternalActivity) {
|
if (getActivity() instanceof ChooseLockGeneric.InternalActivity) {
|
||||||
mPasswordConfirmed = !confirmCredentials;
|
mPasswordConfirmed = !confirmCredentials;
|
||||||
}
|
}
|
||||||
|
mHideDrawer = getActivity().getIntent().getBooleanExtra(EXTRA_HIDE_DRAWER, false);
|
||||||
|
|
||||||
mHasChallenge = getActivity().getIntent().getBooleanExtra(
|
mHasChallenge = getActivity().getIntent().getBooleanExtra(
|
||||||
ChooseLockSettingsHelper.EXTRA_KEY_HAS_CHALLENGE, false);
|
ChooseLockSettingsHelper.EXTRA_KEY_HAS_CHALLENGE, false);
|
||||||
@@ -263,6 +271,7 @@ public class ChooseLockGeneric extends SettingsActivity {
|
|||||||
unlockMethodIntent);
|
unlockMethodIntent);
|
||||||
intent.putExtra(ChooseLockSettingsHelper.EXTRA_KEY_FOR_FINGERPRINT,
|
intent.putExtra(ChooseLockSettingsHelper.EXTRA_KEY_FOR_FINGERPRINT,
|
||||||
mForFingerprint);
|
mForFingerprint);
|
||||||
|
intent.putExtra(EXTRA_HIDE_DRAWER, mHideDrawer);
|
||||||
startActivityForResult(intent, ENABLE_ENCRYPTION_REQUEST);
|
startActivityForResult(intent, ENABLE_ENCRYPTION_REQUEST);
|
||||||
} else {
|
} else {
|
||||||
if (mForChangeCredRequiredForBoot) {
|
if (mForChangeCredRequiredForBoot) {
|
||||||
@@ -613,6 +622,9 @@ public class ChooseLockGeneric extends SettingsActivity {
|
|||||||
mUserPassword, mUserId);
|
mUserPassword, mUserId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (intent != null) {
|
||||||
|
intent.putExtra(EXTRA_HIDE_DRAWER, mHideDrawer);
|
||||||
|
}
|
||||||
return intent;
|
return intent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -186,6 +186,7 @@ public class ChooseLockPassword extends SettingsActivity {
|
|||||||
private static final int MSG_SHOW_ERROR = 1;
|
private static final int MSG_SHOW_ERROR = 1;
|
||||||
|
|
||||||
private int mUserId;
|
private int mUserId;
|
||||||
|
private boolean mHideDrawer = false;
|
||||||
|
|
||||||
private Handler mHandler = new Handler() {
|
private Handler mHandler = new Handler() {
|
||||||
@Override
|
@Override
|
||||||
@@ -267,6 +268,7 @@ public class ChooseLockPassword extends SettingsActivity {
|
|||||||
mUserId));
|
mUserId));
|
||||||
|
|
||||||
mChooseLockSettingsHelper = new ChooseLockSettingsHelper(getActivity());
|
mChooseLockSettingsHelper = new ChooseLockSettingsHelper(getActivity());
|
||||||
|
mHideDrawer = getActivity().getIntent().getBooleanExtra(EXTRA_HIDE_DRAWER, false);
|
||||||
|
|
||||||
if (intent.getBooleanExtra(
|
if (intent.getBooleanExtra(
|
||||||
ChooseLockSettingsHelper.EXTRA_KEY_FOR_CHANGE_CRED_REQUIRED_FOR_BOOT, false)) {
|
ChooseLockSettingsHelper.EXTRA_KEY_FOR_CHANGE_CRED_REQUIRED_FOR_BOOT, false)) {
|
||||||
@@ -673,6 +675,7 @@ public class ChooseLockPassword extends SettingsActivity {
|
|||||||
if (!wasSecureBefore) {
|
if (!wasSecureBefore) {
|
||||||
Intent intent = getRedactionInterstitialIntent(getActivity());
|
Intent intent = getRedactionInterstitialIntent(getActivity());
|
||||||
if (intent != null) {
|
if (intent != null) {
|
||||||
|
intent.putExtra(EXTRA_HIDE_DRAWER, mHideDrawer);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -146,6 +146,7 @@ public class ChooseLockPattern extends SettingsActivity {
|
|||||||
private TextView mFooterLeftButton;
|
private TextView mFooterLeftButton;
|
||||||
private TextView mFooterRightButton;
|
private TextView mFooterRightButton;
|
||||||
protected List<LockPatternView.Cell> mChosenPattern = null;
|
protected List<LockPatternView.Cell> mChosenPattern = null;
|
||||||
|
private boolean mHideDrawer = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The patten used during the help screen to show how to draw a pattern.
|
* The patten used during the help screen to show how to draw a pattern.
|
||||||
@@ -384,6 +385,7 @@ public class ChooseLockPattern extends SettingsActivity {
|
|||||||
w.start(mChooseLockSettingsHelper.utils(), required,
|
w.start(mChooseLockSettingsHelper.utils(), required,
|
||||||
false, 0, LockPatternUtils.stringToPattern(current), current, mUserId);
|
false, 0, LockPatternUtils.stringToPattern(current), current, mUserId);
|
||||||
}
|
}
|
||||||
|
mHideDrawer = getActivity().getIntent().getBooleanExtra(EXTRA_HIDE_DRAWER, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -674,6 +676,7 @@ public class ChooseLockPattern extends SettingsActivity {
|
|||||||
if (!wasSecureBefore) {
|
if (!wasSecureBefore) {
|
||||||
Intent intent = getRedactionInterstitialIntent(getActivity());
|
Intent intent = getRedactionInterstitialIntent(getActivity());
|
||||||
if (intent != null) {
|
if (intent != null) {
|
||||||
|
intent.putExtra(EXTRA_HIDE_DRAWER, mHideDrawer);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -210,6 +210,8 @@ public final class ChooseLockSettingsHelper {
|
|||||||
intent.putExtra(ConfirmDeviceCredentialBaseFragment.SHOW_WHEN_LOCKED, external);
|
intent.putExtra(ConfirmDeviceCredentialBaseFragment.SHOW_WHEN_LOCKED, external);
|
||||||
intent.putExtra(ChooseLockSettingsHelper.EXTRA_KEY_HAS_CHALLENGE, hasChallenge);
|
intent.putExtra(ChooseLockSettingsHelper.EXTRA_KEY_HAS_CHALLENGE, hasChallenge);
|
||||||
intent.putExtra(ChooseLockSettingsHelper.EXTRA_KEY_CHALLENGE, challenge);
|
intent.putExtra(ChooseLockSettingsHelper.EXTRA_KEY_CHALLENGE, challenge);
|
||||||
|
// we should never have a drawer when confirming device credentials.
|
||||||
|
intent.putExtra(SettingsActivity.EXTRA_HIDE_DRAWER, true);
|
||||||
intent.putExtra(Intent.EXTRA_USER_ID, userId);
|
intent.putExtra(Intent.EXTRA_USER_ID, userId);
|
||||||
intent.setClassName(ConfirmDeviceCredentialBaseFragment.PACKAGE, activityClass.getName());
|
intent.setClassName(ConfirmDeviceCredentialBaseFragment.PACKAGE, activityClass.getName());
|
||||||
if (external) {
|
if (external) {
|
||||||
|
@@ -199,6 +199,8 @@ public class SettingsActivity extends SettingsDrawerActivity
|
|||||||
public static final String EXTRA_SHOW_FRAGMENT_AS_SUBSETTING =
|
public static final String EXTRA_SHOW_FRAGMENT_AS_SUBSETTING =
|
||||||
":settings:show_fragment_as_subsetting";
|
":settings:show_fragment_as_subsetting";
|
||||||
|
|
||||||
|
public static final String EXTRA_HIDE_DRAWER = ":settings:hide_drawer";
|
||||||
|
|
||||||
public static final String META_DATA_KEY_FRAGMENT_CLASS =
|
public static final String META_DATA_KEY_FRAGMENT_CLASS =
|
||||||
"com.android.settings.FRAGMENT_CLASS";
|
"com.android.settings.FRAGMENT_CLASS";
|
||||||
|
|
||||||
@@ -511,6 +513,9 @@ public class SettingsActivity extends SettingsDrawerActivity
|
|||||||
if (intent.hasExtra(EXTRA_UI_OPTIONS)) {
|
if (intent.hasExtra(EXTRA_UI_OPTIONS)) {
|
||||||
getWindow().setUiOptions(intent.getIntExtra(EXTRA_UI_OPTIONS, 0));
|
getWindow().setUiOptions(intent.getIntExtra(EXTRA_UI_OPTIONS, 0));
|
||||||
}
|
}
|
||||||
|
if (intent.getBooleanExtra(EXTRA_HIDE_DRAWER, false)) {
|
||||||
|
setIsDrawerPresent(false);
|
||||||
|
}
|
||||||
|
|
||||||
mDevelopmentPreferences = getSharedPreferences(DevelopmentSettings.PREF_FILE,
|
mDevelopmentPreferences = getSharedPreferences(DevelopmentSettings.PREF_FILE,
|
||||||
Context.MODE_PRIVATE);
|
Context.MODE_PRIVATE);
|
||||||
|
Reference in New Issue
Block a user