Loading core/java/android/app/WallpaperManager.java +36 −2 Original line number Diff line number Diff line Loading @@ -67,6 +67,8 @@ public class WallpaperManager { private static boolean DEBUG = false; private float mWallpaperXStep = -1; private float mWallpaperYStep = -1; private int mWallpaperXOverscroll = -1; private int mWallpaperYOverscroll = -1; /** * Activity Action: Show settings for choosing wallpaper. Do not use directly to construct Loading Loading @@ -950,14 +952,46 @@ public class WallpaperManager { public void setWallpaperOffsets(IBinder windowToken, float xOffset, float yOffset) { try { //Log.v(TAG, "Sending new wallpaper offsets from app..."); WindowManagerGlobal.getWindowSession().setWallpaperPosition( windowToken, xOffset, yOffset, mWallpaperXStep, mWallpaperYStep); WindowManagerGlobal.getWindowSession().setWallpaperPositionOverscroll( windowToken, xOffset, yOffset, mWallpaperXStep, mWallpaperYStep, -1, -1, mWallpaperXOverscroll, mWallpaperYOverscroll); //Log.v(TAG, "...app returning after sending offsets!"); } catch (RemoteException e) { // Ignore. } } /** * Set the position of the current wallpaper within any larger space, when * that wallpaper is visible behind the given window. The X and Y offsets * are floating point numbers ranging from 0 to 1, representing where the * wallpaper should be positioned within the range specified by setWallpaperOverscroll. * * @param windowToken The window who these offsets should be associated * with, as returned by {@link android.view.View#getWindowToken() * View.getWindowToken()}. * @param xOverscrollOffset The overscroll offset along the X dimension, from 0 to 1. * @param yOverscrollOffset The overscroll offset along the Y dimension, from 0 to 1. */ public void setWallpaperOverscrollOffsets(IBinder windowToken, float xOverscrollOffset, float yOverscrollOffset) { try { //Log.v(TAG, "Sending new wallpaper offsets from app..."); WindowManagerGlobal.getWindowSession().setWallpaperPositionOverscroll( windowToken, -1, -1, mWallpaperXStep, mWallpaperYStep, xOverscrollOffset, yOverscrollOffset, mWallpaperXOverscroll, mWallpaperYOverscroll); //Log.v(TAG, "...app returning after sending offsets!"); } catch (RemoteException e) { // Ignore. } } public void setWallpaperOverscroll(int xOverscroll, int yOverscroll) { mWallpaperXOverscroll = xOverscroll; mWallpaperYOverscroll = yOverscroll; } /** * For applications that use multiple virtual screens showing a wallpaper, * specify the step size between virtual screens. For example, if the Loading core/java/android/view/IWindowSession.aidl +10 −0 Original line number Diff line number Diff line Loading @@ -175,6 +175,16 @@ interface IWindowSession { */ void setWallpaperPosition(IBinder windowToken, float x, float y, float xstep, float ystep); /** * For windows with the wallpaper behind them, and the wallpaper is * larger than the screen, set the offset within the screen. * For multi screen launcher type applications, xstep and ystep indicate * how big the increment is from one screen to another. */ void setWallpaperPositionOverscroll(IBinder windowToken, float x, float y, float xstep, float ystep, float xoverscroll, float yoverscroll, int xoverscrollmax, int yoverscrollmax); void wallpaperOffsetsComplete(IBinder window); Bundle sendWallpaperCommand(IBinder window, String action, int x, int y, Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/BarTransitions.java +9 −0 Original line number Diff line number Diff line Loading @@ -41,6 +41,7 @@ public class BarTransitions { public static final int MODE_SEMI_TRANSPARENT = 1; public static final int MODE_TRANSLUCENT = 2; public static final int MODE_LIGHTS_OUT = 3; public static final int MODE_TRANSPARENT = 4; public static final int LIGHTS_IN_DURATION = 250; public static final int LIGHTS_OUT_DURATION = 750; Loading Loading @@ -92,6 +93,8 @@ public class BarTransitions { if (mode == MODE_SEMI_TRANSPARENT) return "MODE_SEMI_TRANSPARENT"; if (mode == MODE_TRANSLUCENT) return "MODE_TRANSLUCENT"; if (mode == MODE_LIGHTS_OUT) return "MODE_LIGHTS_OUT"; if (mode == MODE_TRANSPARENT) return "MODE_TRANSPARENT"; if (DEBUG && mode == -1) return "-1"; throw new IllegalArgumentException("Unknown mode " + mode); } Loading @@ -103,6 +106,10 @@ public class BarTransitions { // for subclasses } public void applyTransparent(boolean sticky) { // for subclasses } private static class BarBackgroundDrawable extends Drawable { private final int mOpaque; private final int mSemiTransparent; Loading Loading @@ -182,6 +189,8 @@ public class BarTransitions { targetGradientAlpha = 0xff; } else if (mMode == MODE_SEMI_TRANSPARENT) { targetColor = mSemiTransparent; } else if (mMode == MODE_TRANSPARENT) { targetGradientAlpha = 0; } else { targetColor = mOpaque; } Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarTransitions.java +14 −0 Original line number Diff line number Diff line Loading @@ -41,6 +41,7 @@ public final class NavigationBarTransitions extends BarTransitions { private boolean mLightsOut; private boolean mVertical; private int mRequestedMode; private boolean mStickyTransparent; public NavigationBarTransitions(NavigationBarView view) { super(view, R.drawable.nav_background); Loading @@ -66,6 +67,8 @@ public final class NavigationBarTransitions extends BarTransitions { if (mVertical && mode == MODE_TRANSLUCENT) { // translucent mode not allowed when vertical mode = MODE_OPAQUE; } else if (mStickyTransparent) { mode = MODE_TRANSPARENT; } super.transitionTo(mode, animate); } Loading Loading @@ -125,6 +128,17 @@ public final class NavigationBarTransitions extends BarTransitions { } } public void applyTransparent(boolean sticky) { if (sticky != mStickyTransparent) { mStickyTransparent = sticky; if (!mStickyTransparent) { transitionTo(mRequestedMode, false); } else { transitionTo(MODE_TRANSPARENT, false); } } } private static float maxVisibleQuiescentAlpha(float max, View v) { if ((v instanceof KeyButtonView) && v.isShown()) { return Math.max(max, ((KeyButtonView)v).getQuiescentAlpha()); Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java +79 −1 Original line number Diff line number Diff line Loading @@ -25,18 +25,25 @@ import android.app.ActivityManagerNative; import android.app.StatusBarManager; import android.app.admin.DevicePolicyManager; import android.content.BroadcastReceiver; import android.content.ContentResolver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.content.pm.ApplicationInfo; import android.content.pm.PackageManager; import android.content.pm.PackageManager.NameNotFoundException; import android.content.res.Configuration; import android.content.res.Resources; import android.database.ContentObserver; import android.graphics.Point; import android.graphics.Rect; import android.graphics.drawable.Drawable; import android.os.Bundle; import android.os.Handler; import android.os.Message; import android.os.RemoteException; import android.os.UserHandle; import android.provider.Settings; import android.util.AttributeSet; import android.util.Log; import android.view.Display; Loading Loading @@ -110,6 +117,9 @@ public class NavigationBarView extends LinearLayout { // performs manual animation in sync with layout transitions private final NavTransitionListener mTransitionListener = new NavTransitionListener(); private boolean mModLockDisabled = true; private SettingsObserver mObserver; private class NavTransitionListener implements TransitionListener { private boolean mBackTransitioning; private boolean mHomeAppearing; Loading Loading @@ -238,6 +248,8 @@ public class NavigationBarView extends LinearLayout { new IntentFilter(NAVBAR_EDIT_ACTION), null, null); mLockUtils = new LockPatternUtils(context); mObserver = new SettingsObserver(new Handler()); } private void watchForDevicePolicyChanges() { Loading Loading @@ -500,8 +512,9 @@ public class NavigationBarView extends LinearLayout { final boolean showSearch = disableHome && !disableSearch; final boolean showCamera = showSearch && !mCameraDisabledByDpm && mLockUtils.getCameraEnabled(); setVisibleOrGone(getSearchLight(), showSearch); setVisibleOrGone(getCameraButton(), showCamera); setVisibleOrGone(getCameraButton(), showCamera && mModLockDisabled); mBarTransitions.applyBackButtonQuiescentAlpha(mBarTransitions.getMode(), true /*animate*/); } Loading Loading @@ -567,6 +580,24 @@ public class NavigationBarView extends LinearLayout { watchForAccessibilityChanges(); } @Override public void onAttachedToWindow() { super.onAttachedToWindow(); final Bundle keyguard_metadata = NavigationBarView .getApplicationMetadata(mContext, "com.android.keyguard"); if (null != keyguard_metadata && keyguard_metadata.getBoolean("com.cyanogenmod.keyguard", false)) { mObserver.observe(); } } @Override public void onDetachedFromWindow() { super.onDetachedFromWindow(); mObserver.unobserve(); } private void watchForAccessibilityChanges() { final AccessibilityManager am = (AccessibilityManager) mContext.getSystemService(Context.ACCESSIBILITY_SERVICE); Loading Loading @@ -790,4 +821,51 @@ public class NavigationBarView extends LinearLayout { } pw.println(); } private static Bundle getApplicationMetadata(Context context, String pkg) { if (pkg != null) { try { ApplicationInfo ai = context.getPackageManager(). getApplicationInfo(pkg, PackageManager.GET_META_DATA); return ai.metaData; } catch (NameNotFoundException e) { return null; } } return null; } private class SettingsObserver extends ContentObserver { private boolean mObserving = false; SettingsObserver(Handler handler) { super(handler); } void observe() { mObserving = true; ContentResolver resolver = mContext.getContentResolver(); resolver.registerContentObserver( Settings.System.getUriFor(Settings.System.LOCKSCREEN_MODLOCK_ENABLED), false, this); // intialize mModlockDisabled onChange(false); } void unobserve() { if (mObserving) { mContext.getContentResolver().unregisterContentObserver(this); mObserving = false; } } @Override public void onChange(boolean selfChange) { mModLockDisabled = Settings.System.getInt(mContext.getContentResolver(), Settings.System.LOCKSCREEN_MODLOCK_ENABLED, 1) == 0; setDisabledFlags(mDisabledFlags, true /* force */); } } } Loading
core/java/android/app/WallpaperManager.java +36 −2 Original line number Diff line number Diff line Loading @@ -67,6 +67,8 @@ public class WallpaperManager { private static boolean DEBUG = false; private float mWallpaperXStep = -1; private float mWallpaperYStep = -1; private int mWallpaperXOverscroll = -1; private int mWallpaperYOverscroll = -1; /** * Activity Action: Show settings for choosing wallpaper. Do not use directly to construct Loading Loading @@ -950,14 +952,46 @@ public class WallpaperManager { public void setWallpaperOffsets(IBinder windowToken, float xOffset, float yOffset) { try { //Log.v(TAG, "Sending new wallpaper offsets from app..."); WindowManagerGlobal.getWindowSession().setWallpaperPosition( windowToken, xOffset, yOffset, mWallpaperXStep, mWallpaperYStep); WindowManagerGlobal.getWindowSession().setWallpaperPositionOverscroll( windowToken, xOffset, yOffset, mWallpaperXStep, mWallpaperYStep, -1, -1, mWallpaperXOverscroll, mWallpaperYOverscroll); //Log.v(TAG, "...app returning after sending offsets!"); } catch (RemoteException e) { // Ignore. } } /** * Set the position of the current wallpaper within any larger space, when * that wallpaper is visible behind the given window. The X and Y offsets * are floating point numbers ranging from 0 to 1, representing where the * wallpaper should be positioned within the range specified by setWallpaperOverscroll. * * @param windowToken The window who these offsets should be associated * with, as returned by {@link android.view.View#getWindowToken() * View.getWindowToken()}. * @param xOverscrollOffset The overscroll offset along the X dimension, from 0 to 1. * @param yOverscrollOffset The overscroll offset along the Y dimension, from 0 to 1. */ public void setWallpaperOverscrollOffsets(IBinder windowToken, float xOverscrollOffset, float yOverscrollOffset) { try { //Log.v(TAG, "Sending new wallpaper offsets from app..."); WindowManagerGlobal.getWindowSession().setWallpaperPositionOverscroll( windowToken, -1, -1, mWallpaperXStep, mWallpaperYStep, xOverscrollOffset, yOverscrollOffset, mWallpaperXOverscroll, mWallpaperYOverscroll); //Log.v(TAG, "...app returning after sending offsets!"); } catch (RemoteException e) { // Ignore. } } public void setWallpaperOverscroll(int xOverscroll, int yOverscroll) { mWallpaperXOverscroll = xOverscroll; mWallpaperYOverscroll = yOverscroll; } /** * For applications that use multiple virtual screens showing a wallpaper, * specify the step size between virtual screens. For example, if the Loading
core/java/android/view/IWindowSession.aidl +10 −0 Original line number Diff line number Diff line Loading @@ -175,6 +175,16 @@ interface IWindowSession { */ void setWallpaperPosition(IBinder windowToken, float x, float y, float xstep, float ystep); /** * For windows with the wallpaper behind them, and the wallpaper is * larger than the screen, set the offset within the screen. * For multi screen launcher type applications, xstep and ystep indicate * how big the increment is from one screen to another. */ void setWallpaperPositionOverscroll(IBinder windowToken, float x, float y, float xstep, float ystep, float xoverscroll, float yoverscroll, int xoverscrollmax, int yoverscrollmax); void wallpaperOffsetsComplete(IBinder window); Bundle sendWallpaperCommand(IBinder window, String action, int x, int y, Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/BarTransitions.java +9 −0 Original line number Diff line number Diff line Loading @@ -41,6 +41,7 @@ public class BarTransitions { public static final int MODE_SEMI_TRANSPARENT = 1; public static final int MODE_TRANSLUCENT = 2; public static final int MODE_LIGHTS_OUT = 3; public static final int MODE_TRANSPARENT = 4; public static final int LIGHTS_IN_DURATION = 250; public static final int LIGHTS_OUT_DURATION = 750; Loading Loading @@ -92,6 +93,8 @@ public class BarTransitions { if (mode == MODE_SEMI_TRANSPARENT) return "MODE_SEMI_TRANSPARENT"; if (mode == MODE_TRANSLUCENT) return "MODE_TRANSLUCENT"; if (mode == MODE_LIGHTS_OUT) return "MODE_LIGHTS_OUT"; if (mode == MODE_TRANSPARENT) return "MODE_TRANSPARENT"; if (DEBUG && mode == -1) return "-1"; throw new IllegalArgumentException("Unknown mode " + mode); } Loading @@ -103,6 +106,10 @@ public class BarTransitions { // for subclasses } public void applyTransparent(boolean sticky) { // for subclasses } private static class BarBackgroundDrawable extends Drawable { private final int mOpaque; private final int mSemiTransparent; Loading Loading @@ -182,6 +189,8 @@ public class BarTransitions { targetGradientAlpha = 0xff; } else if (mMode == MODE_SEMI_TRANSPARENT) { targetColor = mSemiTransparent; } else if (mMode == MODE_TRANSPARENT) { targetGradientAlpha = 0; } else { targetColor = mOpaque; } Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarTransitions.java +14 −0 Original line number Diff line number Diff line Loading @@ -41,6 +41,7 @@ public final class NavigationBarTransitions extends BarTransitions { private boolean mLightsOut; private boolean mVertical; private int mRequestedMode; private boolean mStickyTransparent; public NavigationBarTransitions(NavigationBarView view) { super(view, R.drawable.nav_background); Loading @@ -66,6 +67,8 @@ public final class NavigationBarTransitions extends BarTransitions { if (mVertical && mode == MODE_TRANSLUCENT) { // translucent mode not allowed when vertical mode = MODE_OPAQUE; } else if (mStickyTransparent) { mode = MODE_TRANSPARENT; } super.transitionTo(mode, animate); } Loading Loading @@ -125,6 +128,17 @@ public final class NavigationBarTransitions extends BarTransitions { } } public void applyTransparent(boolean sticky) { if (sticky != mStickyTransparent) { mStickyTransparent = sticky; if (!mStickyTransparent) { transitionTo(mRequestedMode, false); } else { transitionTo(MODE_TRANSPARENT, false); } } } private static float maxVisibleQuiescentAlpha(float max, View v) { if ((v instanceof KeyButtonView) && v.isShown()) { return Math.max(max, ((KeyButtonView)v).getQuiescentAlpha()); Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java +79 −1 Original line number Diff line number Diff line Loading @@ -25,18 +25,25 @@ import android.app.ActivityManagerNative; import android.app.StatusBarManager; import android.app.admin.DevicePolicyManager; import android.content.BroadcastReceiver; import android.content.ContentResolver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.content.pm.ApplicationInfo; import android.content.pm.PackageManager; import android.content.pm.PackageManager.NameNotFoundException; import android.content.res.Configuration; import android.content.res.Resources; import android.database.ContentObserver; import android.graphics.Point; import android.graphics.Rect; import android.graphics.drawable.Drawable; import android.os.Bundle; import android.os.Handler; import android.os.Message; import android.os.RemoteException; import android.os.UserHandle; import android.provider.Settings; import android.util.AttributeSet; import android.util.Log; import android.view.Display; Loading Loading @@ -110,6 +117,9 @@ public class NavigationBarView extends LinearLayout { // performs manual animation in sync with layout transitions private final NavTransitionListener mTransitionListener = new NavTransitionListener(); private boolean mModLockDisabled = true; private SettingsObserver mObserver; private class NavTransitionListener implements TransitionListener { private boolean mBackTransitioning; private boolean mHomeAppearing; Loading Loading @@ -238,6 +248,8 @@ public class NavigationBarView extends LinearLayout { new IntentFilter(NAVBAR_EDIT_ACTION), null, null); mLockUtils = new LockPatternUtils(context); mObserver = new SettingsObserver(new Handler()); } private void watchForDevicePolicyChanges() { Loading Loading @@ -500,8 +512,9 @@ public class NavigationBarView extends LinearLayout { final boolean showSearch = disableHome && !disableSearch; final boolean showCamera = showSearch && !mCameraDisabledByDpm && mLockUtils.getCameraEnabled(); setVisibleOrGone(getSearchLight(), showSearch); setVisibleOrGone(getCameraButton(), showCamera); setVisibleOrGone(getCameraButton(), showCamera && mModLockDisabled); mBarTransitions.applyBackButtonQuiescentAlpha(mBarTransitions.getMode(), true /*animate*/); } Loading Loading @@ -567,6 +580,24 @@ public class NavigationBarView extends LinearLayout { watchForAccessibilityChanges(); } @Override public void onAttachedToWindow() { super.onAttachedToWindow(); final Bundle keyguard_metadata = NavigationBarView .getApplicationMetadata(mContext, "com.android.keyguard"); if (null != keyguard_metadata && keyguard_metadata.getBoolean("com.cyanogenmod.keyguard", false)) { mObserver.observe(); } } @Override public void onDetachedFromWindow() { super.onDetachedFromWindow(); mObserver.unobserve(); } private void watchForAccessibilityChanges() { final AccessibilityManager am = (AccessibilityManager) mContext.getSystemService(Context.ACCESSIBILITY_SERVICE); Loading Loading @@ -790,4 +821,51 @@ public class NavigationBarView extends LinearLayout { } pw.println(); } private static Bundle getApplicationMetadata(Context context, String pkg) { if (pkg != null) { try { ApplicationInfo ai = context.getPackageManager(). getApplicationInfo(pkg, PackageManager.GET_META_DATA); return ai.metaData; } catch (NameNotFoundException e) { return null; } } return null; } private class SettingsObserver extends ContentObserver { private boolean mObserving = false; SettingsObserver(Handler handler) { super(handler); } void observe() { mObserving = true; ContentResolver resolver = mContext.getContentResolver(); resolver.registerContentObserver( Settings.System.getUriFor(Settings.System.LOCKSCREEN_MODLOCK_ENABLED), false, this); // intialize mModlockDisabled onChange(false); } void unobserve() { if (mObserving) { mContext.getContentResolver().unregisterContentObserver(this); mObserving = false; } } @Override public void onChange(boolean selfChange) { mModLockDisabled = Settings.System.getInt(mContext.getContentResolver(), Settings.System.LOCKSCREEN_MODLOCK_ENABLED, 1) == 0; setDisabledFlags(mDisabledFlags, true /* force */); } } }