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

Commit a59e6234 authored by Michael Wright's avatar Michael Wright
Browse files

Add config option for permanent dpad presence.

Since all TV devices are required to have a DPad as a form of
navigation we should suppress any configuration instances where it
claims one doesn't exist just because it isn't currently connected.

This prevents applications from going through a configuration change
and potentially an app restart when a remote disconnects to save
battery.

Bug: 17493314
Change-Id: Ice87b7056984afe02917ccba9196fdbcac9985fc
parent a11757c1
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -1646,6 +1646,9 @@
         2 - The device DOES NOT have a permanent menu key; ignore autodetection. -->
    <integer name="config_overrideHasPermanentMenuKey">0</integer>

    <!-- Override the DPad detection behavior for configuration purposes -->
    <bool name="config_hasPermanentDpad">false</bool>

    <!-- default window inset isRound property -->
    <bool name="config_windowIsRound">false</bool>

+1 −0
Original line number Diff line number Diff line
@@ -346,6 +346,7 @@
  <java-symbol type="integer" name="config_volte_replacement_rat"/>
  <java-symbol type="integer" name="config_valid_wappush_index" />
  <java-symbol type="integer" name="config_overrideHasPermanentMenuKey" />
  <java-symbol type="bool" name="config_hasPermanentDpad" />

  <java-symbol type="color" name="tab_indicator_text_v4" />

+10 −0
Original line number Diff line number Diff line
@@ -333,6 +333,8 @@ public class WindowManagerService extends IWindowManager.Stub

    final boolean mHaveInputMethods;

    final boolean mHasPermanentDpad;

    final boolean mAllowBootMessages;

    final boolean mLimitedAlphaCompositing;
@@ -804,6 +806,8 @@ public class WindowManagerService extends IWindowManager.Stub
        mOnlyCore = onlyCore;
        mLimitedAlphaCompositing = context.getResources().getBoolean(
                com.android.internal.R.bool.config_sf_limitedAlpha);
        mHasPermanentDpad = context.getResources().getBoolean(
                com.android.internal.R.bool.config_hasPermanentDpad);
        mInputManager = inputManager; // Must be before createDisplayContentLocked.
        mDisplayManagerInternal = LocalServices.getService(DisplayManagerInternal.class);
        mDisplaySettings = new DisplaySettings(context);
@@ -7182,6 +7186,11 @@ public class WindowManagerService extends IWindowManager.Stub
                }
            }

            if (config.navigation == Configuration.NAVIGATION_NONAV && mHasPermanentDpad) {
                config.navigation = Configuration.NAVIGATION_DPAD;
                navigationPresence |= WindowManagerPolicy.PRESENCE_INTERNAL;
            }

            // Determine whether a hard keyboard is available and enabled.
            boolean hardKeyboardAvailable = config.keyboard != Configuration.KEYBOARD_NOKEYS;
            if (hardKeyboardAvailable != mHardKeyboardAvailable) {
@@ -10976,6 +10985,7 @@ public class WindowManagerService extends IWindowManager.Stub
        }
        pw.println();
        pw.print("  mCurConfiguration="); pw.println(this.mCurConfiguration);
        pw.print("  mHasPermanentDpad="); pw.println(mHasPermanentDpad);
        pw.print("  mCurrentFocus="); pw.println(mCurrentFocus);
        if (mLastFocus != mCurrentFocus) {
            pw.print("  mLastFocus="); pw.println(mLastFocus);