From dd05ab7600f79a6e77b6b5ed3916823d5985df72 Mon Sep 17 00:00:00 2001 From: Udam Saini Date: Mon, 21 Mar 2016 17:35:08 -0700 Subject: [PATCH] Changes SetupRedactionInterstitial to be an optional step We no longer need this to be in inside the setup flow when setting up the lock screen. Move this class to be used as an optional step if a lock screen is added. bug:23893721 Change-Id: I15478e0f0d8d8771cbdce6ccf0f508cbd5dd4f36 --- AndroidManifest.xml | 16 +++++++++++- res/drawable/ic_suggested_notifications.xml | 25 +++++++++++++++++++ res/values/strings.xml | 5 ++++ .../settings/SetupChooseLockGeneric.java | 8 ++++++ .../settings/SetupChooseLockPassword.java | 6 +---- .../settings/SetupChooseLockPattern.java | 6 +---- .../settings/SetupRedactionInterstitial.java | 16 +++--------- 7 files changed, 58 insertions(+), 24 deletions(-) create mode 100644 res/drawable/ic_suggested_notifications.xml diff --git a/AndroidManifest.xml b/AndroidManifest.xml index 72f567e1e14..4b976b559cb 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -1550,8 +1550,22 @@ + android:theme="@style/SetupWizardDisableAppStartingTheme" + android:icon="@drawable/ic_suggested_notifications"> + + + + + + + + diff --git a/res/drawable/ic_suggested_notifications.xml b/res/drawable/ic_suggested_notifications.xml new file mode 100644 index 00000000000..00bd7368469 --- /dev/null +++ b/res/drawable/ic_suggested_notifications.xml @@ -0,0 +1,25 @@ + + + + diff --git a/res/values/strings.xml b/res/values/strings.xml index bc89640b8fe..be043be93ed 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -7359,4 +7359,9 @@ Reset ShortcutManager rate-limiting counters? + + Control lock screen notifications + + Show or hide notification content + diff --git a/src/com/android/settings/SetupChooseLockGeneric.java b/src/com/android/settings/SetupChooseLockGeneric.java index 4f0d4ea0cb5..8aaca25b7e4 100644 --- a/src/com/android/settings/SetupChooseLockGeneric.java +++ b/src/com/android/settings/SetupChooseLockGeneric.java @@ -18,8 +18,10 @@ package com.android.settings; import android.app.Activity; import android.app.admin.DevicePolicyManager; +import android.content.ComponentName; import android.content.Context; import android.content.Intent; +import android.content.pm.PackageManager; import android.content.res.Resources; import android.os.Bundle; import android.os.UserHandle; @@ -118,6 +120,12 @@ public class SetupChooseLockGeneric extends ChooseLockGeneric { data.putExtra(EXTRA_PASSWORD_QUALITY, lockPatternUtils.getKeyguardStoredPasswordQuality(UserHandle.myUserId())); + PackageManager packageManager = getPackageManager(); + ComponentName componentName = new ComponentName("com.android.settings", + "com.android.settings.SetupRedactionInterstitial"); + packageManager.setComponentEnabledSetting(componentName, + PackageManager.COMPONENT_ENABLED_STATE_ENABLED, + PackageManager.DONT_KILL_APP); super.onActivityResult(requestCode, resultCode, data); } // If the started activity was cancelled (e.g. the user presses back), then this diff --git a/src/com/android/settings/SetupChooseLockPassword.java b/src/com/android/settings/SetupChooseLockPassword.java index e1e0d51ae29..00c30bc5020 100644 --- a/src/com/android/settings/SetupChooseLockPassword.java +++ b/src/com/android/settings/SetupChooseLockPassword.java @@ -109,11 +109,7 @@ public class SetupChooseLockPassword extends ChooseLockPassword { @Override protected Intent getRedactionInterstitialIntent(Context context) { - Intent intent = SetupRedactionInterstitial.createStartIntent(context); - if (intent != null) { - SetupWizardUtils.copySetupExtras(getActivity().getIntent(), intent); - } - return intent; + return null; } @Override diff --git a/src/com/android/settings/SetupChooseLockPattern.java b/src/com/android/settings/SetupChooseLockPattern.java index 3a548bc7a98..a5eab11d769 100644 --- a/src/com/android/settings/SetupChooseLockPattern.java +++ b/src/com/android/settings/SetupChooseLockPattern.java @@ -105,11 +105,7 @@ public class SetupChooseLockPattern extends ChooseLockPattern { @Override protected Intent getRedactionInterstitialIntent(Context context) { - Intent intent = SetupRedactionInterstitial.createStartIntent(context); - if (intent != null) { - SetupWizardUtils.copySetupExtras(getActivity().getIntent(), intent); - } - return intent; + return null; } @Override diff --git a/src/com/android/settings/SetupRedactionInterstitial.java b/src/com/android/settings/SetupRedactionInterstitial.java index e967297af91..354016d8723 100644 --- a/src/com/android/settings/SetupRedactionInterstitial.java +++ b/src/com/android/settings/SetupRedactionInterstitial.java @@ -39,27 +39,17 @@ import com.android.setupwizardlib.view.NavigationBar; */ public class SetupRedactionInterstitial extends RedactionInterstitial { - public static Intent createStartIntent(Context ctx) { - Intent startIntent = RedactionInterstitial.createStartIntent(ctx, UserHandle.myUserId()); - if (startIntent != null) { - startIntent.setClass(ctx, SetupRedactionInterstitial.class); - startIntent.putExtra(EXTRA_PREFS_SHOW_BUTTON_BAR, false) - .putExtra(EXTRA_SHOW_FRAGMENT_TITLE_RESID, -1); - } - return startIntent; - } - @Override public Intent getIntent() { Intent modIntent = new Intent(super.getIntent()); modIntent.putExtra(EXTRA_SHOW_FRAGMENT, - SetupEncryptionInterstitialFragment.class.getName()); + SetupRedactionInterstitialFragment.class.getName()); return modIntent; } @Override protected boolean isValidFragment(String fragmentName) { - return SetupEncryptionInterstitialFragment.class.getName().equals(fragmentName); + return SetupRedactionInterstitialFragment.class.getName().equals(fragmentName); } @Override @@ -68,7 +58,7 @@ public class SetupRedactionInterstitial extends RedactionInterstitial { super.onApplyThemeResource(theme, resid, first); } - public static class SetupEncryptionInterstitialFragment extends RedactionInterstitialFragment + public static class SetupRedactionInterstitialFragment extends RedactionInterstitialFragment implements NavigationBar.NavigationBarListener { @Override