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