Loading core/java/android/app/IWallpaperManager.aidl +1 −1 Original line number Diff line number Diff line Loading @@ -159,5 +159,5 @@ interface IWallpaperManager { /** * Called from SystemUI when it shows the AoD UI. */ void setInAmbientMode(boolean inAmbienMode); void setInAmbientMode(boolean inAmbientMode, boolean animated); } core/java/android/service/wallpaper/IWallpaperEngine.aidl +1 −1 Original line number Diff line number Diff line Loading @@ -27,7 +27,7 @@ oneway interface IWallpaperEngine { void setDesiredSize(int width, int height); void setDisplayPadding(in Rect padding); void setVisibility(boolean visible); void setInAmbientMode(boolean inAmbientDisplay); void setInAmbientMode(boolean inAmbientDisplay, boolean animated); void dispatchPointer(in MotionEvent event); void dispatchWallpaperCommand(String action, int x, int y, int z, in Bundle extras); Loading core/java/android/service/wallpaper/WallpaperService.java +15 −8 Original line number Diff line number Diff line Loading @@ -563,9 +563,12 @@ public abstract class WallpaperService extends Service { * Called when the device enters or exits ambient mode. * * @param inAmbientMode {@code true} if in ambient mode. * @param animated {@code true} if you'll have te opportunity of animating your transition * {@code false} when the screen will blank and the wallpaper should be * set to ambient mode immediately. * @hide */ public void onAmbientModeChanged(boolean inAmbientMode) { public void onAmbientModeChanged(boolean inAmbientMode, boolean animated) { } /** Loading Loading @@ -1021,18 +1024,20 @@ public abstract class WallpaperService extends Service { * Executes life cycle event and updates internal ambient mode state based on * message sent from handler. * * @param inAmbientMode True if in ambient mode. * @param inAmbientMode {@code true} if in ambient mode. * @param animated {@code true} if the transition will be animated. * @hide */ @VisibleForTesting public void doAmbientModeChanged(boolean inAmbientMode) { public void doAmbientModeChanged(boolean inAmbientMode, boolean animated) { if (!mDestroyed) { if (DEBUG) { Log.v(TAG, "onAmbientModeChanged(" + inAmbientMode + "): " + this); Log.v(TAG, "onAmbientModeChanged(" + inAmbientMode + ", " + animated + "): " + this); } mIsInAmbientMode = inAmbientMode; if (mCreated) { onAmbientModeChanged(inAmbientMode); onAmbientModeChanged(inAmbientMode, animated); } } } Loading Loading @@ -1278,8 +1283,10 @@ public abstract class WallpaperService extends Service { } @Override public void setInAmbientMode(boolean inAmbientDisplay) throws RemoteException { Message msg = mCaller.obtainMessageI(DO_IN_AMBIENT_MODE, inAmbientDisplay ? 1 : 0); public void setInAmbientMode(boolean inAmbientDisplay, boolean animated) throws RemoteException { Message msg = mCaller.obtainMessageII(DO_IN_AMBIENT_MODE, inAmbientDisplay ? 1 : 0, animated ? 1 : 0); mCaller.sendMessage(msg); } Loading Loading @@ -1350,7 +1357,7 @@ public abstract class WallpaperService extends Service { return; } case DO_IN_AMBIENT_MODE: { mEngine.doAmbientModeChanged(message.arg1 != 0); mEngine.doAmbientModeChanged(message.arg1 != 0, message.arg2 != 0); return; } case MSG_UPDATE_SURFACE: Loading packages/SystemUI/src/com/android/systemui/doze/DozeFactory.java +1 −1 Original line number Diff line number Diff line Loading @@ -66,7 +66,7 @@ public class DozeFactory { createDozeUi(context, host, wakeLock, machine, handler, alarmManager, params), new DozeScreenState(wrappedService, handler), createDozeScreenBrightness(context, wrappedService, sensorManager, host, handler), new DozeWallpaperState() new DozeWallpaperState(context) }); return machine; Loading packages/SystemUI/src/com/android/systemui/doze/DozeWallpaperState.java +30 −8 Original line number Diff line number Diff line Loading @@ -23,6 +23,10 @@ import android.os.ServiceManager; import android.util.Log; import com.android.internal.annotations.VisibleForTesting; import com.android.keyguard.KeyguardUpdateMonitor; import com.android.keyguard.KeyguardUpdateMonitorCallback; import com.android.systemui.statusbar.phone.DozeParameters; import com.android.systemui.statusbar.phone.StatusBarKeyguardViewManager; import java.io.PrintWriter; Loading @@ -34,18 +38,28 @@ public class DozeWallpaperState implements DozeMachine.Part { private static final String TAG = "DozeWallpaperState"; private static final boolean DEBUG = Log.isLoggable(TAG, Log.DEBUG); @VisibleForTesting final IWallpaperManager mWallpaperManagerService; private final IWallpaperManager mWallpaperManagerService; private boolean mKeyguardVisible; private boolean mIsAmbientMode; private final DozeParameters mDozeParameters; public DozeWallpaperState() { public DozeWallpaperState(Context context) { this(IWallpaperManager.Stub.asInterface( ServiceManager.getService(Context.WALLPAPER_SERVICE))); ServiceManager.getService(Context.WALLPAPER_SERVICE)), new DozeParameters(context), KeyguardUpdateMonitor.getInstance(context)); } @VisibleForTesting DozeWallpaperState(IWallpaperManager wallpaperManagerService) { DozeWallpaperState(IWallpaperManager wallpaperManagerService, DozeParameters parameters, KeyguardUpdateMonitor keyguardUpdateMonitor) { mWallpaperManagerService = wallpaperManagerService; mDozeParameters = parameters; keyguardUpdateMonitor.registerCallback(new KeyguardUpdateMonitorCallback() { @Override public void onKeyguardVisibilityChanged(boolean showing) { mKeyguardVisible = showing; } }); } @Override Loading @@ -58,17 +72,25 @@ public class DozeWallpaperState implements DozeMachine.Part { case DOZE_REQUEST_PULSE: case DOZE_PULSING: case DOZE_PULSE_DONE: isAmbientMode = true; isAmbientMode = mDozeParameters.getAlwaysOn(); break; default: isAmbientMode = false; } final boolean animated; if (isAmbientMode) { animated = mDozeParameters.getCanControlScreenOffAnimation() && !mKeyguardVisible; } else { animated = !mDozeParameters.getDisplayNeedsBlanking(); } if (isAmbientMode != mIsAmbientMode) { mIsAmbientMode = isAmbientMode; try { Log.i(TAG, "AoD wallpaper state changed to: " + mIsAmbientMode); mWallpaperManagerService.setInAmbientMode(mIsAmbientMode); Log.i(TAG, "AoD wallpaper state changed to: " + mIsAmbientMode + ", animated: " + animated); mWallpaperManagerService.setInAmbientMode(mIsAmbientMode, animated); } catch (RemoteException e) { // Cannot notify wallpaper manager service, but it's fine, let's just skip it. Log.w(TAG, "Cannot notify state to WallpaperManagerService: " + mIsAmbientMode); Loading Loading
core/java/android/app/IWallpaperManager.aidl +1 −1 Original line number Diff line number Diff line Loading @@ -159,5 +159,5 @@ interface IWallpaperManager { /** * Called from SystemUI when it shows the AoD UI. */ void setInAmbientMode(boolean inAmbienMode); void setInAmbientMode(boolean inAmbientMode, boolean animated); }
core/java/android/service/wallpaper/IWallpaperEngine.aidl +1 −1 Original line number Diff line number Diff line Loading @@ -27,7 +27,7 @@ oneway interface IWallpaperEngine { void setDesiredSize(int width, int height); void setDisplayPadding(in Rect padding); void setVisibility(boolean visible); void setInAmbientMode(boolean inAmbientDisplay); void setInAmbientMode(boolean inAmbientDisplay, boolean animated); void dispatchPointer(in MotionEvent event); void dispatchWallpaperCommand(String action, int x, int y, int z, in Bundle extras); Loading
core/java/android/service/wallpaper/WallpaperService.java +15 −8 Original line number Diff line number Diff line Loading @@ -563,9 +563,12 @@ public abstract class WallpaperService extends Service { * Called when the device enters or exits ambient mode. * * @param inAmbientMode {@code true} if in ambient mode. * @param animated {@code true} if you'll have te opportunity of animating your transition * {@code false} when the screen will blank and the wallpaper should be * set to ambient mode immediately. * @hide */ public void onAmbientModeChanged(boolean inAmbientMode) { public void onAmbientModeChanged(boolean inAmbientMode, boolean animated) { } /** Loading Loading @@ -1021,18 +1024,20 @@ public abstract class WallpaperService extends Service { * Executes life cycle event and updates internal ambient mode state based on * message sent from handler. * * @param inAmbientMode True if in ambient mode. * @param inAmbientMode {@code true} if in ambient mode. * @param animated {@code true} if the transition will be animated. * @hide */ @VisibleForTesting public void doAmbientModeChanged(boolean inAmbientMode) { public void doAmbientModeChanged(boolean inAmbientMode, boolean animated) { if (!mDestroyed) { if (DEBUG) { Log.v(TAG, "onAmbientModeChanged(" + inAmbientMode + "): " + this); Log.v(TAG, "onAmbientModeChanged(" + inAmbientMode + ", " + animated + "): " + this); } mIsInAmbientMode = inAmbientMode; if (mCreated) { onAmbientModeChanged(inAmbientMode); onAmbientModeChanged(inAmbientMode, animated); } } } Loading Loading @@ -1278,8 +1283,10 @@ public abstract class WallpaperService extends Service { } @Override public void setInAmbientMode(boolean inAmbientDisplay) throws RemoteException { Message msg = mCaller.obtainMessageI(DO_IN_AMBIENT_MODE, inAmbientDisplay ? 1 : 0); public void setInAmbientMode(boolean inAmbientDisplay, boolean animated) throws RemoteException { Message msg = mCaller.obtainMessageII(DO_IN_AMBIENT_MODE, inAmbientDisplay ? 1 : 0, animated ? 1 : 0); mCaller.sendMessage(msg); } Loading Loading @@ -1350,7 +1357,7 @@ public abstract class WallpaperService extends Service { return; } case DO_IN_AMBIENT_MODE: { mEngine.doAmbientModeChanged(message.arg1 != 0); mEngine.doAmbientModeChanged(message.arg1 != 0, message.arg2 != 0); return; } case MSG_UPDATE_SURFACE: Loading
packages/SystemUI/src/com/android/systemui/doze/DozeFactory.java +1 −1 Original line number Diff line number Diff line Loading @@ -66,7 +66,7 @@ public class DozeFactory { createDozeUi(context, host, wakeLock, machine, handler, alarmManager, params), new DozeScreenState(wrappedService, handler), createDozeScreenBrightness(context, wrappedService, sensorManager, host, handler), new DozeWallpaperState() new DozeWallpaperState(context) }); return machine; Loading
packages/SystemUI/src/com/android/systemui/doze/DozeWallpaperState.java +30 −8 Original line number Diff line number Diff line Loading @@ -23,6 +23,10 @@ import android.os.ServiceManager; import android.util.Log; import com.android.internal.annotations.VisibleForTesting; import com.android.keyguard.KeyguardUpdateMonitor; import com.android.keyguard.KeyguardUpdateMonitorCallback; import com.android.systemui.statusbar.phone.DozeParameters; import com.android.systemui.statusbar.phone.StatusBarKeyguardViewManager; import java.io.PrintWriter; Loading @@ -34,18 +38,28 @@ public class DozeWallpaperState implements DozeMachine.Part { private static final String TAG = "DozeWallpaperState"; private static final boolean DEBUG = Log.isLoggable(TAG, Log.DEBUG); @VisibleForTesting final IWallpaperManager mWallpaperManagerService; private final IWallpaperManager mWallpaperManagerService; private boolean mKeyguardVisible; private boolean mIsAmbientMode; private final DozeParameters mDozeParameters; public DozeWallpaperState() { public DozeWallpaperState(Context context) { this(IWallpaperManager.Stub.asInterface( ServiceManager.getService(Context.WALLPAPER_SERVICE))); ServiceManager.getService(Context.WALLPAPER_SERVICE)), new DozeParameters(context), KeyguardUpdateMonitor.getInstance(context)); } @VisibleForTesting DozeWallpaperState(IWallpaperManager wallpaperManagerService) { DozeWallpaperState(IWallpaperManager wallpaperManagerService, DozeParameters parameters, KeyguardUpdateMonitor keyguardUpdateMonitor) { mWallpaperManagerService = wallpaperManagerService; mDozeParameters = parameters; keyguardUpdateMonitor.registerCallback(new KeyguardUpdateMonitorCallback() { @Override public void onKeyguardVisibilityChanged(boolean showing) { mKeyguardVisible = showing; } }); } @Override Loading @@ -58,17 +72,25 @@ public class DozeWallpaperState implements DozeMachine.Part { case DOZE_REQUEST_PULSE: case DOZE_PULSING: case DOZE_PULSE_DONE: isAmbientMode = true; isAmbientMode = mDozeParameters.getAlwaysOn(); break; default: isAmbientMode = false; } final boolean animated; if (isAmbientMode) { animated = mDozeParameters.getCanControlScreenOffAnimation() && !mKeyguardVisible; } else { animated = !mDozeParameters.getDisplayNeedsBlanking(); } if (isAmbientMode != mIsAmbientMode) { mIsAmbientMode = isAmbientMode; try { Log.i(TAG, "AoD wallpaper state changed to: " + mIsAmbientMode); mWallpaperManagerService.setInAmbientMode(mIsAmbientMode); Log.i(TAG, "AoD wallpaper state changed to: " + mIsAmbientMode + ", animated: " + animated); mWallpaperManagerService.setInAmbientMode(mIsAmbientMode, animated); } catch (RemoteException e) { // Cannot notify wallpaper manager service, but it's fine, let's just skip it. Log.w(TAG, "Cannot notify state to WallpaperManagerService: " + mIsAmbientMode); Loading