Loading core/java/android/provider/Settings.java +7 −0 Original line number Diff line number Diff line Loading @@ -2467,6 +2467,13 @@ public final class Settings { */ public static final String LOCKSCREEN_TARGETS = "lockscreen_targets"; /** * Whether music controls should be shown on the lockscreen if a supporting * music player is active. * @hide */ public static final String LOCKSCREEN_MUSIC_CONTROLS = "lockscreen_music_controls"; /** * @deprecated Use {@link android.provider.Settings.Global#LOW_BATTERY_SOUND} * instead Loading policy/src/com/android/internal/policy/impl/keyguard/KeyguardHostView.java +6 −2 Original line number Diff line number Diff line Loading @@ -79,6 +79,7 @@ public class KeyguardHostView extends KeyguardViewBase { static final int TRANSPORT_VISIBLE = 2; private int mTransportState = TRANSPORT_GONE; private boolean mTransportShouldBeVisible; // Use this to debug all of keyguard public static boolean DEBUG = KeyguardViewMediator.DEBUG; Loading Loading @@ -400,6 +401,9 @@ public class KeyguardHostView extends KeyguardViewBase { setBackButtonEnabled(false); mTransportShouldBeVisible = Settings.System.getIntForUser(mContext.getContentResolver(), Settings.System.LOCKSCREEN_MUSIC_CONTROLS, 1, UserHandle.USER_CURRENT) != 0; updateBackground(); addDefaultWidgets(); Loading Loading @@ -1541,7 +1545,7 @@ public class KeyguardHostView extends KeyguardViewBase { final boolean showing = getWidgetPosition(R.id.keyguard_transport_control) != -1; final boolean visible = state == TRANSPORT_VISIBLE; final boolean shouldBeVisible = state == TRANSPORT_INVISIBLE && isMusicPlaying(state); if (!showing && (visible || shouldBeVisible)) { if (!showing && mTransportShouldBeVisible && (visible || shouldBeVisible)) { if (DEBUGXPORT) Log.v(TAG, "add transport"); // insert to left of camera if it exists, otherwise after right-most widget int lastWidget = mAppWidgetContainer.getChildCount() - 1; Loading @@ -1551,7 +1555,7 @@ public class KeyguardHostView extends KeyguardViewBase { lastWidget : lastWidget + 1; } mAppWidgetContainer.addWidget(getOrCreateTransportControl(), position); } else if (showing && state == TRANSPORT_GONE) { } else if (showing && (state == TRANSPORT_GONE || !mTransportShouldBeVisible)) { if (DEBUGXPORT) Log.v(TAG, "remove transport"); mAppWidgetContainer.removeWidget(getOrCreateTransportControl()); mTransportControl = null; Loading Loading
core/java/android/provider/Settings.java +7 −0 Original line number Diff line number Diff line Loading @@ -2467,6 +2467,13 @@ public final class Settings { */ public static final String LOCKSCREEN_TARGETS = "lockscreen_targets"; /** * Whether music controls should be shown on the lockscreen if a supporting * music player is active. * @hide */ public static final String LOCKSCREEN_MUSIC_CONTROLS = "lockscreen_music_controls"; /** * @deprecated Use {@link android.provider.Settings.Global#LOW_BATTERY_SOUND} * instead Loading
policy/src/com/android/internal/policy/impl/keyguard/KeyguardHostView.java +6 −2 Original line number Diff line number Diff line Loading @@ -79,6 +79,7 @@ public class KeyguardHostView extends KeyguardViewBase { static final int TRANSPORT_VISIBLE = 2; private int mTransportState = TRANSPORT_GONE; private boolean mTransportShouldBeVisible; // Use this to debug all of keyguard public static boolean DEBUG = KeyguardViewMediator.DEBUG; Loading Loading @@ -400,6 +401,9 @@ public class KeyguardHostView extends KeyguardViewBase { setBackButtonEnabled(false); mTransportShouldBeVisible = Settings.System.getIntForUser(mContext.getContentResolver(), Settings.System.LOCKSCREEN_MUSIC_CONTROLS, 1, UserHandle.USER_CURRENT) != 0; updateBackground(); addDefaultWidgets(); Loading Loading @@ -1541,7 +1545,7 @@ public class KeyguardHostView extends KeyguardViewBase { final boolean showing = getWidgetPosition(R.id.keyguard_transport_control) != -1; final boolean visible = state == TRANSPORT_VISIBLE; final boolean shouldBeVisible = state == TRANSPORT_INVISIBLE && isMusicPlaying(state); if (!showing && (visible || shouldBeVisible)) { if (!showing && mTransportShouldBeVisible && (visible || shouldBeVisible)) { if (DEBUGXPORT) Log.v(TAG, "add transport"); // insert to left of camera if it exists, otherwise after right-most widget int lastWidget = mAppWidgetContainer.getChildCount() - 1; Loading @@ -1551,7 +1555,7 @@ public class KeyguardHostView extends KeyguardViewBase { lastWidget : lastWidget + 1; } mAppWidgetContainer.addWidget(getOrCreateTransportControl(), position); } else if (showing && state == TRANSPORT_GONE) { } else if (showing && (state == TRANSPORT_GONE || !mTransportShouldBeVisible)) { if (DEBUGXPORT) Log.v(TAG, "remove transport"); mAppWidgetContainer.removeWidget(getOrCreateTransportControl()); mTransportControl = null; Loading