Loading core/java/android/app/DisabledWallpaperManager.java +6 −7 Original line number Diff line number Diff line Loading @@ -41,8 +41,7 @@ final class DisabledWallpaperManager extends WallpaperManager { // Don't need to worry about synchronization private static DisabledWallpaperManager sInstance; // TODO(b/138939803): STOPSHIP changed to false and/or remove it private static final boolean DEBUG = true; private static final boolean DEBUG = false; @NonNull static DisabledWallpaperManager getInstance() { Loading @@ -53,7 +52,6 @@ final class DisabledWallpaperManager extends WallpaperManager { } private DisabledWallpaperManager() { super(null, null, null); } @Override Loading @@ -66,10 +64,6 @@ final class DisabledWallpaperManager extends WallpaperManager { return false; } // TODO(b/138939803): STOPSHIP methods below should not be necessary, // callers should check if isWallpaperSupported(), consider removing them to keep this class // simpler private static <T> T unsupported() { if (DEBUG) Log.w(TAG, "unsupported method called; returning null", new Exception()); return null; Loading Loading @@ -343,4 +337,9 @@ final class DisabledWallpaperManager extends WallpaperManager { public boolean isWallpaperBackupEligible(int which) { return unsupportedBoolean(); } @Override public boolean wallpaperSupportsWcg(int which) { return unsupportedBoolean(); } } core/java/android/app/SystemServiceRegistry.java +9 −8 Original line number Diff line number Diff line Loading @@ -54,6 +54,7 @@ import android.content.integrity.AppIntegrityManager; import android.content.integrity.IAppIntegrityManager; import android.content.om.IOverlayManager; import android.content.om.OverlayManager; import android.content.pm.ApplicationInfo; import android.content.pm.CrossProfileApps; import android.content.pm.DataLoaderManager; import android.content.pm.ICrossProfileApps; Loading Loading @@ -693,20 +694,20 @@ public final class SystemServiceRegistry { throws ServiceNotFoundException { final IBinder b = ServiceManager.getService(Context.WALLPAPER_SERVICE); if (b == null) { // There are 2 reason service can be null: // 1.Device doesn't support it - that's fine // 2.App is running on instant mode - should fail ApplicationInfo appInfo = ctx.getApplicationInfo(); if (appInfo.targetSdkVersion >= Build.VERSION_CODES.P && appInfo.isInstantApp()) { // Instant app throw new ServiceNotFoundException(Context.WALLPAPER_SERVICE); } final boolean enabled = Resources.getSystem() .getBoolean(com.android.internal.R.bool.config_enableWallpaperService); if (!enabled) { // Life moves on... // Device doesn't support wallpaper, return a limited manager return DisabledWallpaperManager.getInstance(); } if (ctx.getApplicationInfo().targetSdkVersion >= Build.VERSION_CODES.P) { // Instant app throw new ServiceNotFoundException(Context.WALLPAPER_SERVICE); } // Bad state - WallpaperManager methods will throw exception Log.e(TAG, "No wallpaper service"); } IWallpaperManager service = IWallpaperManager.Stub.asInterface(b); return new WallpaperManager(service, ctx.getOuterContext(), Loading core/java/android/app/WallpaperManager.java +7 −0 Original line number Diff line number Diff line Loading @@ -543,6 +543,13 @@ public class WallpaperManager { mCmProxy = new ColorManagementProxy(context); } // no-op constructor called just by DisabledWallpaperManager /*package*/ WallpaperManager() { mContext = null; mCmProxy = null; mWcgEnabled = false; } /** * Retrieve a WallpaperManager associated with the given Context. */ Loading Loading
core/java/android/app/DisabledWallpaperManager.java +6 −7 Original line number Diff line number Diff line Loading @@ -41,8 +41,7 @@ final class DisabledWallpaperManager extends WallpaperManager { // Don't need to worry about synchronization private static DisabledWallpaperManager sInstance; // TODO(b/138939803): STOPSHIP changed to false and/or remove it private static final boolean DEBUG = true; private static final boolean DEBUG = false; @NonNull static DisabledWallpaperManager getInstance() { Loading @@ -53,7 +52,6 @@ final class DisabledWallpaperManager extends WallpaperManager { } private DisabledWallpaperManager() { super(null, null, null); } @Override Loading @@ -66,10 +64,6 @@ final class DisabledWallpaperManager extends WallpaperManager { return false; } // TODO(b/138939803): STOPSHIP methods below should not be necessary, // callers should check if isWallpaperSupported(), consider removing them to keep this class // simpler private static <T> T unsupported() { if (DEBUG) Log.w(TAG, "unsupported method called; returning null", new Exception()); return null; Loading Loading @@ -343,4 +337,9 @@ final class DisabledWallpaperManager extends WallpaperManager { public boolean isWallpaperBackupEligible(int which) { return unsupportedBoolean(); } @Override public boolean wallpaperSupportsWcg(int which) { return unsupportedBoolean(); } }
core/java/android/app/SystemServiceRegistry.java +9 −8 Original line number Diff line number Diff line Loading @@ -54,6 +54,7 @@ import android.content.integrity.AppIntegrityManager; import android.content.integrity.IAppIntegrityManager; import android.content.om.IOverlayManager; import android.content.om.OverlayManager; import android.content.pm.ApplicationInfo; import android.content.pm.CrossProfileApps; import android.content.pm.DataLoaderManager; import android.content.pm.ICrossProfileApps; Loading Loading @@ -693,20 +694,20 @@ public final class SystemServiceRegistry { throws ServiceNotFoundException { final IBinder b = ServiceManager.getService(Context.WALLPAPER_SERVICE); if (b == null) { // There are 2 reason service can be null: // 1.Device doesn't support it - that's fine // 2.App is running on instant mode - should fail ApplicationInfo appInfo = ctx.getApplicationInfo(); if (appInfo.targetSdkVersion >= Build.VERSION_CODES.P && appInfo.isInstantApp()) { // Instant app throw new ServiceNotFoundException(Context.WALLPAPER_SERVICE); } final boolean enabled = Resources.getSystem() .getBoolean(com.android.internal.R.bool.config_enableWallpaperService); if (!enabled) { // Life moves on... // Device doesn't support wallpaper, return a limited manager return DisabledWallpaperManager.getInstance(); } if (ctx.getApplicationInfo().targetSdkVersion >= Build.VERSION_CODES.P) { // Instant app throw new ServiceNotFoundException(Context.WALLPAPER_SERVICE); } // Bad state - WallpaperManager methods will throw exception Log.e(TAG, "No wallpaper service"); } IWallpaperManager service = IWallpaperManager.Stub.asInterface(b); return new WallpaperManager(service, ctx.getOuterContext(), Loading
core/java/android/app/WallpaperManager.java +7 −0 Original line number Diff line number Diff line Loading @@ -543,6 +543,13 @@ public class WallpaperManager { mCmProxy = new ColorManagementProxy(context); } // no-op constructor called just by DisabledWallpaperManager /*package*/ WallpaperManager() { mContext = null; mCmProxy = null; mWcgEnabled = false; } /** * Retrieve a WallpaperManager associated with the given Context. */ Loading