diff options
author | RoboErik <epastern@google.com> | 2014-05-19 19:28:54 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2014-05-19 19:28:54 +0000 |
commit | b4f4f69e4c56ad1217be9a3c792d4723f6db2256 (patch) | |
tree | 623f66215f0a0ae3c984f0da6b5aa41d1797094c /policy | |
parent | d069cd5164ec4e6edcafa3fb3927675c55e5fe32 (diff) | |
parent | 8a2cfc309ab9126e90022916967c65a793c034f0 (diff) | |
download | frameworks_base-b4f4f69e4c56ad1217be9a3c792d4723f6db2256.zip frameworks_base-b4f4f69e4c56ad1217be9a3c792d4723f6db2256.tar.gz frameworks_base-b4f4f69e4c56ad1217be9a3c792d4723f6db2256.tar.bz2 |
Merge "Move media key processing to sessions"
Diffstat (limited to 'policy')
-rw-r--r-- | policy/src/com/android/internal/policy/impl/PhoneWindowManager.java | 42 |
1 files changed, 25 insertions, 17 deletions
diff --git a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java index 466c8ed..7c89d23 100644 --- a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java +++ b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java @@ -46,6 +46,7 @@ import android.media.AudioSystem; import android.media.IAudioService; import android.media.Ringtone; import android.media.RingtoneManager; +import android.media.session.MediaSessionLegacyHelper; import android.os.Bundle; import android.os.FactoryTest; import android.os.Handler; @@ -137,6 +138,9 @@ public class PhoneWindowManager implements WindowManagerPolicy { static final boolean ENABLE_CAR_DOCK_HOME_CAPTURE = true; static final boolean ENABLE_DESK_DOCK_HOME_CAPTURE = false; + // Whether to use the new Session APIs + static final boolean USE_SESSIONS = true; + static final int LONG_PRESS_POWER_NOTHING = 0; static final int LONG_PRESS_POWER_GLOBAL_ACTIONS = 1; static final int LONG_PRESS_POWER_SHUT_OFF = 2; @@ -1325,11 +1329,11 @@ public class PhoneWindowManager implements WindowManagerPolicy { | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION; } } - + void readLidState() { mLidState = mWindowManagerFuncs.getLidState(); } - + private boolean isHidden(int accessibilityMode) { switch (accessibilityMode) { case 1: @@ -1676,16 +1680,16 @@ public class PhoneWindowManager implements WindowManagerPolicy { /** * Preflight adding a window to the system. - * + * * Currently enforces that three window types are singletons: * <ul> * <li>STATUS_BAR_TYPE</li> * <li>KEYGUARD_TYPE</li> * </ul> - * + * * @param win The window to be added * @param attrs Information about the window to be added - * + * * @return If ok, WindowManagerImpl.ADD_OKAY. If too many singletons, * WindowManagerImpl.ADD_MULTIPLE_SINGLETON */ @@ -1758,7 +1762,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { } static final boolean PRINT_ANIM = false; - + /** {@inheritDoc} */ @Override public int selectAnimationLw(WindowState win, int transit) { @@ -2337,7 +2341,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { Intent intent = new Intent(Intent.ACTION_SEARCH_LONG_PRESS); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); try { - // TODO: This only stops the factory-installed search manager. + // TODO: This only stops the factory-installed search manager. // Need to formalize an API to handle others SearchManager searchManager = getSearchManager(); if (searchManager != null) { @@ -3032,7 +3036,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { if ((fl & (FLAG_LAYOUT_IN_SCREEN | FLAG_LAYOUT_INSET_DECOR)) == (FLAG_LAYOUT_IN_SCREEN | FLAG_LAYOUT_INSET_DECOR)) { - if (DEBUG_LAYOUT) Slog.v(TAG, "layoutWindowLw(" + attrs.getTitle() + if (DEBUG_LAYOUT) Slog.v(TAG, "layoutWindowLw(" + attrs.getTitle() + "): IN_SCREEN, INSET_DECOR"); // This is the case for a normal activity window: we want it // to cover all of the screen space, and it can take care of @@ -3316,7 +3320,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { if (DEBUG_LAYOUT) Slog.v(TAG, "Compute frame " + attrs.getTitle() + ": sim=#" + Integer.toHexString(sim) - + " attach=" + attached + " type=" + attrs.type + + " attach=" + attached + " type=" + attrs.type + String.format(" flags=0x%08x", fl) + " pf=" + pf.toShortString() + " df=" + df.toShortString() + " of=" + of.toShortString() @@ -3365,7 +3369,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { mForceStatusBarFromKeyguard = false; mForcingShowNavBar = false; mForcingShowNavBarLayer = -1; - + mHideLockScreen = false; mAllowLockscreenWhenOn = false; mDismissKeyguard = DISMISS_KEYGUARD_NONE; @@ -4209,12 +4213,16 @@ public class PhoneWindowManager implements WindowManagerPolicy { void dispatchMediaKeyWithWakeLockToAudioService(KeyEvent event) { if (ActivityManagerNative.isSystemReady()) { - IAudioService audioService = getAudioService(); - if (audioService != null) { - try { - audioService.dispatchMediaKeyEventUnderWakelock(event); - } catch (RemoteException e) { - Log.e(TAG, "dispatchMediaKeyEvent threw exception " + e); + if (USE_SESSIONS) { + MediaSessionLegacyHelper.getHelper(mContext).sendMediaButtonEvent(event, true); + } else { + IAudioService audioService = getAudioService(); + if (audioService != null) { + try { + audioService.dispatchMediaKeyEventUnderWakelock(event); + } catch (RemoteException e) { + Log.e(TAG, "dispatchMediaKeyEvent threw exception " + e); + } } } } @@ -4440,7 +4448,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { } public void dismissKeyguardLw() { - if (mKeyguardDelegate != null && mKeyguardDelegate.isShowing()) { + if (mKeyguardDelegate != null && mKeyguardDelegate.isShowing()) { mHandler.post(new Runnable() { public void run() { if (mKeyguardDelegate.isDismissable()) { |