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
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 72f567e..4b976b5 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -1550,8 +1550,22 @@
</activity>
<activity android:name=".SetupRedactionInterstitial"
+ android:enabled="false"
+ android:exported="true"
android:taskAffinity="com.android.wizard"
- android:theme="@style/SetupWizardDisableAppStartingTheme"/>
+ android:theme="@style/SetupWizardDisableAppStartingTheme"
+ android:icon="@drawable/ic_suggested_notifications">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="com.android.settings.suggested.category.DEFAULT_SETUP_WIZARD_ONLY" />
+ </intent-filter>
+ <meta-data android:name="com.android.settings.require_user_type"
+ android:value="primary" />
+ <meta-data android:name="com.android.settings.title"
+ android:resource="@string/notification_suggestion_title" />
+ <meta-data android:name="com.android.settings.summary"
+ android:resource="@string/notification_suggestion_summary" />
+ </activity>
<activity android:name=".notification.RedactionInterstitial"/>
diff --git a/res/drawable/ic_suggested_notifications.xml b/res/drawable/ic_suggested_notifications.xml
new file mode 100644
index 0000000..00bd736
--- /dev/null
+++ b/res/drawable/ic_suggested_notifications.xml
@@ -0,0 +1,25 @@
+<!--
+ Copyright (C) 2016 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="24.0dp"
+ android:height="24.0dp"
+ android:viewportWidth="24.0"
+ android:viewportHeight="24.0"
+ android:tint="@color/suw_color_accent_light">
+ <path
+ android:fillColor="#FFFFFFFF"
+ android:pathData="M12.0,22.0c1.1,0.0 2.0,-0.9 2.0,-2.0l-4.0,0.0c0.0,1.0 0.89,2.0 2.0,2.0zm6.0,-6.0l0.0,-5.0c0.0,-3.07 -1.64,-5.64 -4.5,-6.32L13.5,4.0c0.0,-0.83 -0.67,-1.5 -1.5,-1.5s-1.0,0.67 -1.5,1.5l0.0,0.68C7.63,5.36 6.0,7.92 6.0,11.0l0.0,5.0l-2.0,2.0l0.0,1.0l16.0,0.0l0.0,-1.0l-2.0,-2.0z"/>
+</vector>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index bc89640..be043be 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -7359,4 +7359,9 @@
<!-- Message of the dialog box to confirm resetting rate-limiting in the system service ShortcutManager. [CHAR_LIMIT=none] -->
<string name="confirm_reset_shortcut_manager_throttling_message">Reset ShortcutManager rate-limiting counters?</string>
+ <!-- Title of notification suggestion during optional steps of setup. [CHAR_LIMIT=40] -->
+ <string name="notification_suggestion_title">Control lock screen notifications</string>
+ <!-- Summary of notification suggestion during optional steps of setup. [CHAR_LIMIT=80] -->
+ <string name="notification_suggestion_summary">Show or hide notification content</string>
+
</resources>
diff --git a/src/com/android/settings/SetupChooseLockGeneric.java b/src/com/android/settings/SetupChooseLockGeneric.java
index 4f0d4ea..8aaca25 100644
--- a/src/com/android/settings/SetupChooseLockGeneric.java
+++ b/src/com/android/settings/SetupChooseLockGeneric.java
@@ -18,8 +18,10 @@
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 @@
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 e1e0d51..00c30bc 100644
--- a/src/com/android/settings/SetupChooseLockPassword.java
+++ b/src/com/android/settings/SetupChooseLockPassword.java
@@ -109,11 +109,7 @@
@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 3a548bc..a5eab11 100644
--- a/src/com/android/settings/SetupChooseLockPattern.java
+++ b/src/com/android/settings/SetupChooseLockPattern.java
@@ -105,11 +105,7 @@
@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 e967297..354016d 100644
--- a/src/com/android/settings/SetupRedactionInterstitial.java
+++ b/src/com/android/settings/SetupRedactionInterstitial.java
@@ -39,27 +39,17 @@
*/
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 @@
super.onApplyThemeResource(theme, resid, first);
}
- public static class SetupEncryptionInterstitialFragment extends RedactionInterstitialFragment
+ public static class SetupRedactionInterstitialFragment extends RedactionInterstitialFragment
implements NavigationBar.NavigationBarListener {
@Override