diff options
author | Kunhung Li <kunhungli@google.com> | 2019-05-06 01:26:34 +0800 |
---|---|---|
committer | Kunhung Li <kunhungli@google.com> | 2019-05-08 11:23:53 +0800 |
commit | 0805f179ca8aaef448ffff0ffa0120064c5679bd (patch) | |
tree | 09a9515198dde2a5cc44fe2f8c6e1c6c4a207e78 /src | |
parent | 401c8f0ffce8a755fd0432fda9d0d79139088337 (diff) | |
download | android_packages_wallpapers_LivePicker-0805f179ca8aaef448ffff0ffa0120064c5679bd.tar.gz android_packages_wallpapers_LivePicker-0805f179ca8aaef448ffff0ffa0120064c5679bd.tar.bz2 android_packages_wallpapers_LivePicker-0805f179ca8aaef448ffff0ffa0120064c5679bd.zip |
Revert "Remove pre-installed check for LivePicker"
This reverts commit d21c55c0a148e20ace3672a5e0a984846a26fc85.
Bug: 127218308
Test: Manual test
Change-Id: If99f19af96d742d96c118a2fce7a97bafd76b778
Diffstat (limited to 'src')
-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; + } } |