Add wallpaper suggestion if one isn't set.
Change-Id: I81380323f0d4f5af842a81028a763219958833bc
This commit is contained in:
@@ -830,6 +830,20 @@
|
||||
android:resource="@string/zen_mode_automation_suggestion_title" />
|
||||
</activity>
|
||||
|
||||
<activity android:name="Settings$WallpaperSuggestionActivity"
|
||||
android:label="@string/wallpaper_settings_title"
|
||||
android:exported="true"
|
||||
android:taskAffinity="">
|
||||
<intent-filter android:priority="1">
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="com.android.settings.suggested.category.SETTINGS_ONLY" />
|
||||
</intent-filter>
|
||||
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
||||
android:value="com.android.settings.WallpaperTypeSettings" />
|
||||
<meta-data android:name="com.android.settings.title"
|
||||
android:resource="@string/wallpaper_suggestion_title" />
|
||||
</activity>
|
||||
|
||||
<activity android:name="Settings$ZenModeScheduleRuleSettingsActivity"
|
||||
android:exported="true"
|
||||
android:taskAffinity="">
|
||||
|
@@ -2064,6 +2064,8 @@
|
||||
<string name="screen_timeout_summary">After <xliff:g id="timeout_description">%1$s</xliff:g> of inactivity</string>
|
||||
<!-- Wallpaper settings title [CHAR LIMIT=30] -->
|
||||
<string name="wallpaper_settings_title">Wallpaper</string>
|
||||
<!-- Wallpaper suggestion title [CHAR LIMIT=30] -->
|
||||
<string name="wallpaper_suggestion_title">Set up wallpaper</string>
|
||||
<!-- Wallpaper settings fragment title [CHAR LIMIT=30] -->
|
||||
<string name="wallpaper_settings_fragment_title">Choose wallpaper from</string>
|
||||
<!-- Display settings screen, trigger for screen saver options -->
|
||||
|
@@ -125,6 +125,8 @@ public class Settings extends SettingsActivity {
|
||||
public static class AppWriteSettingsActivity extends SettingsActivity { /* empty */ }
|
||||
public static class ManageDefaultAppsActivity extends SettingsActivity { /* empty */ }
|
||||
|
||||
public static class WallpaperSuggestionActivity extends SettingsActivity { /* empty */ }
|
||||
|
||||
// Categories.
|
||||
public static class WirelessSettings extends SettingsActivity { /* empty */ }
|
||||
public static class DeviceSettings extends SettingsActivity { /* empty */ }
|
||||
|
@@ -314,6 +314,7 @@ public class SettingsActivity extends SettingsDrawerActivity
|
||||
DrawOverlayDetails.class.getName(),
|
||||
WriteSettingsDetails.class.getName(),
|
||||
ManageDefaultApps.class.getName(),
|
||||
WallpaperTypeSettings.class.getName(),
|
||||
};
|
||||
|
||||
|
||||
|
@@ -15,8 +15,16 @@
|
||||
package com.android.settings.dashboard;
|
||||
|
||||
import android.app.AutomaticZenRule;
|
||||
import android.app.IWallpaperManager;
|
||||
import android.app.IWallpaperManager.Stub;
|
||||
import android.app.IWallpaperManagerCallback;
|
||||
import android.app.NotificationManager;
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.os.IBinder;
|
||||
import android.os.RemoteException;
|
||||
import android.os.ServiceManager;
|
||||
import com.android.settings.Settings.WallpaperSuggestionActivity;
|
||||
import com.android.settings.Settings.ZenModeAutomationSuggestionActivity;
|
||||
import com.android.settingslib.drawer.Tile;
|
||||
|
||||
@@ -34,9 +42,11 @@ public class SuggestionsChecks {
|
||||
}
|
||||
|
||||
public boolean isSuggestionComplete(Tile suggestion) {
|
||||
if (suggestion.intent.getComponent().getClassName().equals(
|
||||
ZenModeAutomationSuggestionActivity.class.getName())) {
|
||||
String className = suggestion.intent.getComponent().getClassName();
|
||||
if (className.equals(ZenModeAutomationSuggestionActivity.class.getName())) {
|
||||
return hasEnabledZenAutoRules();
|
||||
} else if (className.equals(WallpaperSuggestionActivity.class.getName())) {
|
||||
return hasWallpaperSet();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -52,4 +62,20 @@ public class SuggestionsChecks {
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean hasWallpaperSet() {
|
||||
IBinder b = ServiceManager.getService(Context.WALLPAPER_SERVICE);
|
||||
IWallpaperManager service = Stub.asInterface(b);
|
||||
try {
|
||||
return service.getWallpaper(mCallback, new Bundle()) != null;
|
||||
} catch (RemoteException e) {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private final IWallpaperManagerCallback mCallback = new IWallpaperManagerCallback.Stub() {
|
||||
@Override
|
||||
public void onWallpaperChanged() throws RemoteException {
|
||||
// Don't care.
|
||||
}
|
||||
};
|
||||
}
|
||||
|
Reference in New Issue
Block a user