summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorandroid-build-team Robot <android-build-team-robot@google.com>2019-03-16 23:06:15 +0000
committerandroid-build-team Robot <android-build-team-robot@google.com>2019-03-16 23:06:15 +0000
commit5839f306f3c6b32079d2835c07092cb9d009da0a (patch)
tree00344b3b8ffd07016d2aa0988f367761b448ab3f
parent2282212b5d6a7569cf5080281dee367240bbce91 (diff)
parentf74466ed9c1ad498711a1bf6291cbf0d61783bb4 (diff)
downloadandroid_packages_wallpapers_LivePicker-5839f306f3c6b32079d2835c07092cb9d009da0a.tar.gz
android_packages_wallpapers_LivePicker-5839f306f3c6b32079d2835c07092cb9d009da0a.tar.bz2
android_packages_wallpapers_LivePicker-5839f306f3c6b32079d2835c07092cb9d009da0a.zip
Snap for 5381581 from f74466ed9c1ad498711a1bf6291cbf0d61783bb4 to qt-release
Change-Id: Id00f765ec7684b3051a383185cf7d3c5a1e0921b
-rw-r--r--src/com/android/wallpaper/livepicker/LiveWallpaperChange.java14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/com/android/wallpaper/livepicker/LiveWallpaperChange.java b/src/com/android/wallpaper/livepicker/LiveWallpaperChange.java
index 412dabd..c25875f 100644
--- a/src/com/android/wallpaper/livepicker/LiveWallpaperChange.java
+++ b/src/com/android/wallpaper/livepicker/LiveWallpaperChange.java
@@ -26,6 +26,7 @@ import android.content.pm.ServiceInfo;
import android.os.Bundle;
import android.os.Parcelable;
import android.service.wallpaper.WallpaperService;
+import android.text.TextUtils;
import android.util.Log;
import androidx.annotation.NonNull;
@@ -51,6 +52,7 @@ public class LiveWallpaperChange extends LiveWallpaperPreview {
}
ComponentName comp = (ComponentName)obj;
+ WallpaperInfo currentWallpaper = WallpaperManager.getInstance(this).getWallpaperInfo();
// Get the information about this component. Implemented this way
// to not allow us to direct the caller to a service that is not a
@@ -71,7 +73,8 @@ public class LiveWallpaperChange extends LiveWallpaperPreview {
finish();
return;
}
- initUI(info, getDeleteAction(ri.serviceInfo));
+ initUI(info, getDeleteAction(ri.serviceInfo,
+ (currentWallpaper == null) ? null : currentWallpaper.getServiceInfo()));
return;
}
}
@@ -82,8 +85,15 @@ public class LiveWallpaperChange extends LiveWallpaperPreview {
}
@Nullable
- private String getDeleteAction(@NonNull ServiceInfo serviceInfo) {
+ private String getDeleteAction(@NonNull ServiceInfo serviceInfo,
+ @Nullable ServiceInfo currentService) {
// STOPSHIP: Check this wallpaper is pre-installed before providing delete action.
+
+ // A currently set Live wallpaper should not be deleted.
+ if (currentService != null && TextUtils.equals(serviceInfo.name, currentService.name)) {
+ return null;
+ }
+
final Bundle metaData = serviceInfo.metaData;
if (metaData != null) {
return metaData.getString(KEY_ACTION_DELETE_LIVE_WALLPAPER);