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
This commit is contained in:
Udam Saini
2016-03-21 17:35:08 -07:00
parent 1997f76cfc
commit dd05ab7600
7 changed files with 58 additions and 24 deletions

View File

@@ -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"/>

View File

@@ -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>

View File

@@ -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>

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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