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

Commit 526d138b authored by Prabir Pradhan's avatar Prabir Pradhan
Browse files

Create FocusEventDebugView to show key presses on screen

Use the following command to enable FocusEventDebugView:

adb shell settings put system show_key_presses 1

Bug: 279026138
Test: manual
Change-Id: I08bedeca1166ec359f31588702d0fe885994a696
parent d8d6ce33
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -5450,6 +5450,14 @@ public final class Settings {
        @Readable
        public static final String SHOW_TOUCHES = "show_touches";
        /**
         * Show key presses and other events dispatched to focused windows on the screen.
         * 0 = no
         * 1 = yes
         * @hide
         */
        public static final String SHOW_KEY_PRESSES = "show_key_presses";
        /**
         * Log raw orientation data from
         * {@link com.android.server.policy.WindowOrientationListener} for use with the
@@ -5840,6 +5848,7 @@ public final class Settings {
            PRIVATE_SETTINGS.add(NOTIFICATION_LIGHT_PULSE);
            PRIVATE_SETTINGS.add(POINTER_LOCATION);
            PRIVATE_SETTINGS.add(SHOW_TOUCHES);
            PRIVATE_SETTINGS.add(SHOW_KEY_PRESSES);
            PRIVATE_SETTINGS.add(WINDOW_ORIENTATION_LISTENER_LOG);
            PRIVATE_SETTINGS.add(POWER_SOUNDS_ENABLED);
            PRIVATE_SETTINGS.add(DOCK_SOUNDS_ENABLED);
+1 −0
Original line number Diff line number Diff line
@@ -68,6 +68,7 @@ message SystemSettingsProto {
        // orientationplot.py tool.
        // 0 = no, 1 = yes
        optional SettingProto window_orientation_listener_log = 3 [ (android.privacy).dest = DEST_AUTOMATIC ];
        optional SettingProto show_key_presses = 4 [ (android.privacy).dest = DEST_AUTOMATIC ];
    }
    optional DevOptions developer_options = 7;

+37 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright 2023 The Android Open Source Project

     Licensed under the Apache License, Version 2.0 (the "License");
     you may not use this file except in compliance with the License.
     You may obtain a copy of the License at

          http://www.apache.org/licenses/LICENSE-2.0

     Unless required by applicable law or agreed to in writing, software
     distributed under the License is distributed on an "AS IS" BASIS,
     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     See the License for the specific language governing permissions and
     limitations under the License.
-->

<shape xmlns:android="http://schemas.android.com/apk/res/android"
       android:name="focus_event_pressed_key_background"
       android:shape="rectangle">

  <!-- View background color -->
  <solid
      android:color="#AA000000" >
  </solid>

  <!-- View border color and width -->
  <stroke
      android:width="2dp"
      android:color="@android:color/white">
  </stroke>

  <!-- The radius makes the corners rounded -->
  <corners
      android:radius="8dp">
  </corners>

</shape>
 No newline at end of file
+2 −0
Original line number Diff line number Diff line
@@ -5119,4 +5119,6 @@
  <java-symbol type="style" name="ThemeOverlay.DeviceDefault.Accent" />
  <java-symbol type="style" name="ThemeOverlay.DeviceDefault.Accent.Light" />
  <java-symbol type="style" name="ThemeOverlay.DeviceDefault.Dark.ActionBar.Accent" />

  <java-symbol type="drawable" name="focus_event_pressed_key_background" />
</resources>
+1 −0
Original line number Diff line number Diff line
@@ -183,6 +183,7 @@ public class SystemSettingsValidators {
        VALIDATORS.put(System.NOTIFICATION_LIGHT_PULSE, BOOLEAN_VALIDATOR);
        VALIDATORS.put(System.POINTER_LOCATION, BOOLEAN_VALIDATOR);
        VALIDATORS.put(System.SHOW_TOUCHES, BOOLEAN_VALIDATOR);
        VALIDATORS.put(System.SHOW_KEY_PRESSES, BOOLEAN_VALIDATOR);
        VALIDATORS.put(System.WINDOW_ORIENTATION_LISTENER_LOG, BOOLEAN_VALIDATOR);
        VALIDATORS.put(System.LOCKSCREEN_SOUNDS_ENABLED, BOOLEAN_VALIDATOR);
        VALIDATORS.put(System.LOCKSCREEN_DISABLED, BOOLEAN_VALIDATOR);
Loading