import android.app.Notification;
import android.app.PendingIntent;
import android.app.StatusBarManager;
+import android.app.WallpaperManager;
import android.content.BroadcastReceiver;
import android.content.ComponentCallbacks2;
import android.content.Context;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.os.SystemClock;
+import android.os.SystemProperties;
import android.os.UserHandle;
import android.os.UserManager;
import android.os.Vibrator;
import com.android.systemui.keyguard.KeyguardViewMediator;
import com.android.systemui.qs.QSPanel;
import com.android.systemui.recents.ScreenPinningRequest;
-import com.android.systemui.recents.events.EventBus;
-import com.android.systemui.recents.events.activity.DockingTopTaskEvent;
import com.android.systemui.stackdivider.Divider;
import com.android.systemui.statusbar.ActivatableNotificationView;
import com.android.systemui.statusbar.BackDropView;
* Prudently disable QS and notifications. */
private static final boolean ONLY_CORE_APPS;
+ /** If true, the lockscreen will show a distinct wallpaper */
+ private static final boolean ENABLE_LOCKSCREEN_WALLPAPER =
+ !ActivityManager.isLowRamDeviceStatic()
+ && SystemProperties.getBoolean("debug.lockscreen_wallpaper", false);
+
/* If true, the device supports freeform window management.
* This affects the status bar UI. */
private static final boolean FREEFORM_WINDOW_MANAGEMENT;
if (state != null) {
if (!isPlaybackActive(state.getState())) {
clearCurrentMediaNotification();
- updateMediaMetaData(true);
+ updateMediaMetaData(true, true);
}
}
}
super.onMetadataChanged(metadata);
if (DEBUG_MEDIA) Log.v(TAG, "DEBUG_MEDIA: onMetadataChanged: " + metadata);
mMediaMetadata = metadata;
- updateMediaMetaData(true);
+ updateMediaMetaData(true, true);
}
};
}
if (key.equals(mMediaNotificationKey)) {
clearCurrentMediaNotification();
- updateMediaMetaData(true);
+ updateMediaMetaData(true, true);
}
if (deferRemoval) {
mLatestRankingMap = ranking;
if (metaDataChanged) {
updateNotifications();
}
- updateMediaMetaData(metaDataChanged);
+ updateMediaMetaData(metaDataChanged, true);
}
private int getMediaControllerPlaybackState(MediaController controller) {
/**
* Refresh or remove lockscreen artwork from media metadata.
*/
- public void updateMediaMetaData(boolean metaDataChanged) {
+ public void updateMediaMetaData(boolean metaDataChanged, boolean allowEnterAnimation) {
if (!SHOW_LOCKSCREEN_MEDIA_ARTWORK) return;
if (mBackdrop == null) return; // called too early
// might still be null
}
}
+ if (ENABLE_LOCKSCREEN_WALLPAPER && artworkBitmap == null) {
+ // TODO: use real lockscreen wallpaper.
+ WallpaperManager wallpaperManager = mContext
+ .getSystemService(WallpaperManager.class);
+ artworkBitmap = wallpaperManager.getBitmap();
+ }
final boolean hasArtwork = artworkBitmap != null;
// time to show some art!
if (mBackdrop.getVisibility() != View.VISIBLE) {
mBackdrop.setVisibility(View.VISIBLE);
- mBackdrop.animate().alpha(1f);
+ if (allowEnterAnimation) {
+ mBackdrop.animate().alpha(1f);
+ } else {
+ mBackdrop.animate().cancel();
+ mBackdrop.setAlpha(1f);
+ }
metaDataChanged = true;
if (DEBUG_MEDIA) {
Log.v(TAG, "DEBUG_MEDIA: Fading in album artwork");
else if (Intent.ACTION_SCREEN_ON.equals(action)) {
notifyNavigationBarScreenOn(true);
}
+ else if (ENABLE_LOCKSCREEN_WALLPAPER
+ && Intent.ACTION_WALLPAPER_CHANGED.equals(action)) {
+ updateMediaMetaData(true, true);
+ }
}
};
}
} else if (ACTION_FAKE_ARTWORK.equals(action)) {
if (DEBUG_MEDIA_FAKE_ARTWORK) {
- updateMediaMetaData(true);
+ updateMediaMetaData(true, true);
}
}
}
resetUserSetupObserver();
setControllerUsers();
clearCurrentMediaNotification();
- updateMediaMetaData(true);
+ updateMediaMetaData(true, false);
}
private void setControllerUsers() {
runLaunchTransitionEndRunnable();
mLaunchTransitionFadingAway = false;
mScrimController.forceHideScrims(false /* hide */);
- updateMediaMetaData(true /* metaDataChanged */);
+ updateMediaMetaData(true /* metaDataChanged */, true);
}
public boolean isCollapsing() {
beforeFading.run();
}
mScrimController.forceHideScrims(true /* hide */);
- updateMediaMetaData(false);
+ updateMediaMetaData(false, true);
mNotificationPanel.setAlpha(1);
mNotificationPanel.animate()
.alpha(0)
updateStackScrollerState(goingToFullShade, fromShadeLocked);
updateNotifications();
checkBarModes();
- updateMediaMetaData(false);
+ updateMediaMetaData(false, mState != StatusBarState.KEYGUARD);
mKeyguardMonitor.notifyKeyguardState(mStatusBarKeyguardViewManager.isShowing(),
mStatusBarKeyguardViewManager.isSecure());
}