Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fdb612e2 authored by Jaewan Kim's avatar Jaewan Kim
Browse files

Prevent play/pause key from starting voice search on TV

CDD enforces the TV devices' remote controllers to have search button,
so long-press of play/pause key to start voice search doesn't make
sense.

Test: Manual, and run CTS (MediaSessionTest)
Bug: 63139504
Change-Id: I757ad4a9f1d9677cefc6403a96c5bf6c7323b575
parent fd20663d
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -108,6 +108,7 @@ public class MediaSessionService extends SystemService implements Monitor {
    private ContentResolver mContentResolver;
    private SettingsObserver mSettingsObserver;
    private INotificationManager mNotificationManager;
    private boolean mHasFeatureLeanback;

    // The FullUserRecord of the current users. (i.e. The foreground user that isn't a profile)
    // It's always not null after the MediaSessionService is started.
@@ -154,6 +155,8 @@ public class MediaSessionService extends SystemService implements Monitor {
        mContentResolver = getContext().getContentResolver();
        mSettingsObserver = new SettingsObserver();
        mSettingsObserver.observe();
        mHasFeatureLeanback = getContext().getPackageManager().hasSystemFeature(
                PackageManager.FEATURE_LEANBACK);

        updateUser();
    }
@@ -1509,7 +1512,7 @@ public class MediaSessionService extends SystemService implements Monitor {

        private boolean isVoiceKey(int keyCode) {
            return keyCode == KeyEvent.KEYCODE_HEADSETHOOK
                    || keyCode == KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE;
                    || (!mHasFeatureLeanback && keyCode == KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE);
        }

        private boolean isUserSetupComplete() {