diff options
author | Kunhung Li <kunhungli@google.com> | 2019-05-09 21:40:45 -0700 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2019-05-09 21:40:45 -0700 |
commit | edc82ba2e75361c89ecccac23d4456a2ffc057a6 (patch) | |
tree | 6c7f93e8c43948dbeab3fbe5945c46dc08659826 | |
parent | f3509180e516a4e519843786ca21f304e4a3bb32 (diff) | |
parent | 0805f179ca8aaef448ffff0ffa0120064c5679bd (diff) | |
download | android_packages_wallpapers_LivePicker-edc82ba2e75361c89ecccac23d4456a2ffc057a6.tar.gz android_packages_wallpapers_LivePicker-edc82ba2e75361c89ecccac23d4456a2ffc057a6.tar.bz2 android_packages_wallpapers_LivePicker-edc82ba2e75361c89ecccac23d4456a2ffc057a6.zip |
Revert "Remove pre-installed check for LivePicker"
am: 0805f179ca
Change-Id: I3161226182f86252e29f1b299c6b27bf7c70ca02
-rw-r--r-- | src/com/android/wallpaper/livepicker/LiveWallpaperChange.java | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/com/android/wallpaper/livepicker/LiveWallpaperChange.java b/src/com/android/wallpaper/livepicker/LiveWallpaperChange.java index c25875f..5dc3f53 100644 --- a/src/com/android/wallpaper/livepicker/LiveWallpaperChange.java +++ b/src/com/android/wallpaper/livepicker/LiveWallpaperChange.java @@ -20,6 +20,7 @@ import android.app.WallpaperInfo; import android.app.WallpaperManager; import android.content.ComponentName; import android.content.Intent; +import android.content.pm.ApplicationInfo; import android.content.pm.PackageManager; import android.content.pm.ResolveInfo; import android.content.pm.ServiceInfo; @@ -87,7 +88,10 @@ public class LiveWallpaperChange extends LiveWallpaperPreview { @Nullable private String getDeleteAction(@NonNull ServiceInfo serviceInfo, @Nullable ServiceInfo currentService) { - // STOPSHIP: Check this wallpaper is pre-installed before providing delete action. + if (!isPackagePreInstalled(serviceInfo.applicationInfo)) { + Log.d(TAG, "This wallpaper is not pre-installed: " + serviceInfo.name); + return null; + } // A currently set Live wallpaper should not be deleted. if (currentService != null && TextUtils.equals(serviceInfo.name, currentService.name)) { @@ -100,4 +104,11 @@ public class LiveWallpaperChange extends LiveWallpaperPreview { } return null; } + + private boolean isPackagePreInstalled(ApplicationInfo info) { + if (info != null && (info.flags & ApplicationInfo.FLAG_SYSTEM) != 0) { + return true; + } + return false; + } } |