Loading AndroidManifest.xml +17 −0 Original line number Diff line number Diff line Loading @@ -848,6 +848,23 @@ <meta-data android:name="com.android.settings.icon_tintable" android:value="true" /> </activity> <activity android:name=".wallpaper.StyleSuggestionActivity" android:label="@string/style_suggestion_title" android:icon="@drawable/ic_theme" android:theme="@android:style/Theme.NoDisplay"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="com.android.settings.suggested.category.FIRST_IMPRESSION" /> </intent-filter> <meta-data android:name="com.android.settings.title" android:resource="@string/style_suggestion_title" /> <meta-data android:name="com.android.settings.summary" android:resource="@string/style_suggestion_summary" /> <meta-data android:name="com.android.settings.dismiss" android:value="3,7,30" /> <meta-data android:name="com.android.settings.icon_tintable" android:value="true" /> </activity> <activity android:name="Settings$ZenModeScheduleRuleSettingsActivity" android:exported="true" Loading res/drawable/ic_theme.xml 0 → 100644 +26 −0 Original line number Diff line number Diff line <!-- Copyright (C) 2019 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. --> <!-- This draws a paintbrush like shape --> <vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" android:viewportWidth="24" android:viewportHeight="24" android:tint="?android:attr/colorAccent"> <path android:fillColor="#FF000000" android:pathData="M4,2v9c0,1.65 1.35,3 3,3h2v6c0,1.1 0.9,2 2,2h2c1.1,0 2,-0.9 2,-2v-6h2c1.65,0 3,-1.35 3,-3V2C20,2 4,2 4,2zM11,20v-6h2v6H11zM18,11c0,0.55 -0.45,1 -1,1h-2H9H7c-0.55,0 -1,-0.45 -1,-1v-0.93h12V11zM18,8.07H6V4h2.81v2.15h2V4h2.38v2.15h2V4H18V8.07z"/> </vector> src/com/android/settings/dashboard/suggestions/SuggestionFeatureProviderImpl.java +3 −0 Original line number Diff line number Diff line Loading @@ -31,6 +31,7 @@ import com.android.settings.notification.ZenOnboardingActivity; import com.android.settings.notification.ZenSuggestionActivity; import com.android.settings.overlay.FeatureFactory; import com.android.settings.password.ScreenLockSuggestionActivity; import com.android.settings.wallpaper.StyleSuggestionActivity; import com.android.settings.wallpaper.WallpaperSuggestionActivity; import com.android.settings.wifi.calling.WifiCallingSuggestionActivity; import com.android.settingslib.core.instrumentation.MetricsFeatureProvider; Loading Loading @@ -62,6 +63,8 @@ public class SuggestionFeatureProviderImpl implements SuggestionFeatureProvider final String className = component.getClassName(); if (className.equals(WallpaperSuggestionActivity.class.getName())) { return WallpaperSuggestionActivity.isSuggestionComplete(context); } else if (className.equals(StyleSuggestionActivity.class.getName())) { return StyleSuggestionActivity.isSuggestionComplete(context); } else if (className.equals(FingerprintSuggestionActivity.class.getName())) { return FingerprintSuggestionActivity.isSuggestionComplete(context); } else if (className.equals(FingerprintEnrollSuggestionActivity.class.getName())) { Loading src/com/android/settings/wallpaper/StyleSuggestionActivity.java 0 → 100644 +41 −0 Original line number Diff line number Diff line /* * Copyright (C) 2019 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 */ package com.android.settings.wallpaper; import android.content.Context; import android.provider.Settings; import android.text.TextUtils; import com.android.internal.annotations.VisibleForTesting; public class StyleSuggestionActivity extends StyleSuggestionActivityBase { @VisibleForTesting public static boolean isSuggestionComplete(Context context) { if (!isWallpaperServiceEnabled(context)) { return true; } final String currentTheme = Settings.Secure.getStringForUser(context.getContentResolver(), Settings.Secure.THEME_CUSTOMIZATION_OVERLAY_PACKAGES, context.getUserId()); if (TextUtils.isEmpty(currentTheme)) { // Empty value means the user has not visited the styles tab yet return false; } return true; } } src/com/android/settings/wallpaper/StyleSuggestionActivityBase.java 0 → 100644 +80 −0 Original line number Diff line number Diff line /* * Copyright (C) 2019 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 */ package com.android.settings.wallpaper; import android.app.Activity; import android.app.settings.SettingsEnums; import android.content.Context; import android.content.Intent; import android.content.pm.PackageManager; import android.os.Bundle; import androidx.annotation.VisibleForTesting; import com.android.settings.R; import com.android.settings.core.SubSettingLauncher; import com.android.settings.display.WallpaperPreferenceController; import com.google.android.setupcompat.util.WizardManagerHelper; public abstract class StyleSuggestionActivityBase extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); final PackageManager pm = getPackageManager(); final Intent intent = new Intent() .setComponent(new WallpaperPreferenceController(this, "dummy key") .getComponentName()) .addFlags(Intent.FLAG_ACTIVITY_FORWARD_RESULT); // passing the necessary extra to next page WizardManagerHelper.copyWizardManagerExtras(getIntent(), intent); addExtras(intent); if (pm.resolveActivity(intent, 0) != null) { startActivity(intent); } else { startFallbackSuggestion(); } finish(); } /** * Add any extras to the intent before launching the wallpaper activity * @param intent */ protected void addExtras(Intent intent) { } @VisibleForTesting void startFallbackSuggestion() { // fall back to default wallpaper picker new SubSettingLauncher(this) .setDestination(WallpaperTypeSettings.class.getName()) .setTitleRes(R.string.wallpaper_suggestion_title) .setSourceMetricsCategory(SettingsEnums.DASHBOARD_SUMMARY) .addFlags(Intent.FLAG_ACTIVITY_FORWARD_RESULT) .launch(); } protected static boolean isWallpaperServiceEnabled(Context context) { return context.getResources().getBoolean( com.android.internal.R.bool.config_enableWallpaperService); } } Loading
AndroidManifest.xml +17 −0 Original line number Diff line number Diff line Loading @@ -848,6 +848,23 @@ <meta-data android:name="com.android.settings.icon_tintable" android:value="true" /> </activity> <activity android:name=".wallpaper.StyleSuggestionActivity" android:label="@string/style_suggestion_title" android:icon="@drawable/ic_theme" android:theme="@android:style/Theme.NoDisplay"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="com.android.settings.suggested.category.FIRST_IMPRESSION" /> </intent-filter> <meta-data android:name="com.android.settings.title" android:resource="@string/style_suggestion_title" /> <meta-data android:name="com.android.settings.summary" android:resource="@string/style_suggestion_summary" /> <meta-data android:name="com.android.settings.dismiss" android:value="3,7,30" /> <meta-data android:name="com.android.settings.icon_tintable" android:value="true" /> </activity> <activity android:name="Settings$ZenModeScheduleRuleSettingsActivity" android:exported="true" Loading
res/drawable/ic_theme.xml 0 → 100644 +26 −0 Original line number Diff line number Diff line <!-- Copyright (C) 2019 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. --> <!-- This draws a paintbrush like shape --> <vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" android:viewportWidth="24" android:viewportHeight="24" android:tint="?android:attr/colorAccent"> <path android:fillColor="#FF000000" android:pathData="M4,2v9c0,1.65 1.35,3 3,3h2v6c0,1.1 0.9,2 2,2h2c1.1,0 2,-0.9 2,-2v-6h2c1.65,0 3,-1.35 3,-3V2C20,2 4,2 4,2zM11,20v-6h2v6H11zM18,11c0,0.55 -0.45,1 -1,1h-2H9H7c-0.55,0 -1,-0.45 -1,-1v-0.93h12V11zM18,8.07H6V4h2.81v2.15h2V4h2.38v2.15h2V4H18V8.07z"/> </vector>
src/com/android/settings/dashboard/suggestions/SuggestionFeatureProviderImpl.java +3 −0 Original line number Diff line number Diff line Loading @@ -31,6 +31,7 @@ import com.android.settings.notification.ZenOnboardingActivity; import com.android.settings.notification.ZenSuggestionActivity; import com.android.settings.overlay.FeatureFactory; import com.android.settings.password.ScreenLockSuggestionActivity; import com.android.settings.wallpaper.StyleSuggestionActivity; import com.android.settings.wallpaper.WallpaperSuggestionActivity; import com.android.settings.wifi.calling.WifiCallingSuggestionActivity; import com.android.settingslib.core.instrumentation.MetricsFeatureProvider; Loading Loading @@ -62,6 +63,8 @@ public class SuggestionFeatureProviderImpl implements SuggestionFeatureProvider final String className = component.getClassName(); if (className.equals(WallpaperSuggestionActivity.class.getName())) { return WallpaperSuggestionActivity.isSuggestionComplete(context); } else if (className.equals(StyleSuggestionActivity.class.getName())) { return StyleSuggestionActivity.isSuggestionComplete(context); } else if (className.equals(FingerprintSuggestionActivity.class.getName())) { return FingerprintSuggestionActivity.isSuggestionComplete(context); } else if (className.equals(FingerprintEnrollSuggestionActivity.class.getName())) { Loading
src/com/android/settings/wallpaper/StyleSuggestionActivity.java 0 → 100644 +41 −0 Original line number Diff line number Diff line /* * Copyright (C) 2019 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 */ package com.android.settings.wallpaper; import android.content.Context; import android.provider.Settings; import android.text.TextUtils; import com.android.internal.annotations.VisibleForTesting; public class StyleSuggestionActivity extends StyleSuggestionActivityBase { @VisibleForTesting public static boolean isSuggestionComplete(Context context) { if (!isWallpaperServiceEnabled(context)) { return true; } final String currentTheme = Settings.Secure.getStringForUser(context.getContentResolver(), Settings.Secure.THEME_CUSTOMIZATION_OVERLAY_PACKAGES, context.getUserId()); if (TextUtils.isEmpty(currentTheme)) { // Empty value means the user has not visited the styles tab yet return false; } return true; } }
src/com/android/settings/wallpaper/StyleSuggestionActivityBase.java 0 → 100644 +80 −0 Original line number Diff line number Diff line /* * Copyright (C) 2019 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 */ package com.android.settings.wallpaper; import android.app.Activity; import android.app.settings.SettingsEnums; import android.content.Context; import android.content.Intent; import android.content.pm.PackageManager; import android.os.Bundle; import androidx.annotation.VisibleForTesting; import com.android.settings.R; import com.android.settings.core.SubSettingLauncher; import com.android.settings.display.WallpaperPreferenceController; import com.google.android.setupcompat.util.WizardManagerHelper; public abstract class StyleSuggestionActivityBase extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); final PackageManager pm = getPackageManager(); final Intent intent = new Intent() .setComponent(new WallpaperPreferenceController(this, "dummy key") .getComponentName()) .addFlags(Intent.FLAG_ACTIVITY_FORWARD_RESULT); // passing the necessary extra to next page WizardManagerHelper.copyWizardManagerExtras(getIntent(), intent); addExtras(intent); if (pm.resolveActivity(intent, 0) != null) { startActivity(intent); } else { startFallbackSuggestion(); } finish(); } /** * Add any extras to the intent before launching the wallpaper activity * @param intent */ protected void addExtras(Intent intent) { } @VisibleForTesting void startFallbackSuggestion() { // fall back to default wallpaper picker new SubSettingLauncher(this) .setDestination(WallpaperTypeSettings.class.getName()) .setTitleRes(R.string.wallpaper_suggestion_title) .setSourceMetricsCategory(SettingsEnums.DASHBOARD_SUMMARY) .addFlags(Intent.FLAG_ACTIVITY_FORWARD_RESULT) .launch(); } protected static boolean isWallpaperServiceEnabled(Context context) { return context.getResources().getBoolean( com.android.internal.R.bool.config_enableWallpaperService); } }