Merge "Add @TestApi to test STYLUS_BUTTONS_ENABLED." into udc-dev

This commit is contained in:
Vania Januar
2023-03-28 08:58:38 +00:00
committed by Android (Google) Code Review
5 changed files with 40 additions and 0 deletions

View File

@@ -415,6 +415,7 @@ package android.app {
method public void clickNotification(@Nullable String, int, int, boolean);
method @RequiresPermission(android.Manifest.permission.STATUS_BAR) public void collapsePanels();
method public void expandNotificationsPanel();
method @RequiresPermission(android.Manifest.permission.STATUS_BAR) public int getLastSystemKey();
method @RequiresPermission(android.Manifest.permission.STATUS_BAR) public void handleSystemKey(int);
method public void sendNotificationFeedback(@Nullable String, @Nullable android.os.Bundle);
method @RequiresPermission(android.Manifest.permission.STATUS_BAR) public void setExpansionDisabledForSimNetworkLock(boolean);
@@ -2628,6 +2629,7 @@ package android.provider {
field public static final String SELECTED_SPELL_CHECKER_SUBTYPE = "selected_spell_checker_subtype";
field public static final String SHOW_FIRST_CRASH_DIALOG_DEV_OPTION = "show_first_crash_dialog_dev_option";
field public static final String SHOW_IME_WITH_HARD_KEYBOARD = "show_ime_with_hard_keyboard";
field public static final String STYLUS_BUTTONS_ENABLED = "stylus_buttons_enabled";
field @RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS) public static final String SYNC_PARENT_SOUNDS = "sync_parent_sounds";
field public static final String VOICE_INTERACTION_SERVICE = "voice_interaction_service";
}

View File

@@ -751,6 +751,29 @@ public class StatusBarManager {
}
}
/**
* Gets the last handled system key. A system key is a KeyEvent that the
* {@link com.android.server.policy.PhoneWindowManager} sends directly to the
* status bar, rather than forwarding to apps. If a key has never been sent to the
* status bar, will return -1.
*
* @return the keycode of the last KeyEvent that has been sent to the system.
* @hide
*/
@RequiresPermission(android.Manifest.permission.STATUS_BAR)
@TestApi
public int getLastSystemKey() {
try {
final IStatusBarService svc = getService();
if (svc != null) {
return svc.getLastSystemKey();
}
} catch (RemoteException ex) {
throw ex.rethrowFromSystemServer();
}
return -1;
}
/**
* Expand the settings panel.
*

View File

@@ -7414,6 +7414,8 @@ public final class Settings {
*
* @hide
*/
@TestApi
@Readable
@SuppressLint("NoSettingsProvider")
public static final String STYLUS_BUTTONS_ENABLED = "stylus_buttons_enabled";

View File

@@ -111,6 +111,7 @@ interface IStatusBarService
void clickTile(in ComponentName tile);
@UnsupportedAppUsage
void handleSystemKey(in int key);
int getLastSystemKey();
/**
* Methods to show toast messages for screen pinning

View File

@@ -33,6 +33,7 @@ import android.Manifest;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.RequiresPermission;
import android.annotation.TestApi;
import android.app.ActivityManager;
import android.app.ActivityManagerInternal;
import android.app.ActivityThread;
@@ -178,6 +179,7 @@ public class StatusBarManagerService extends IStatusBarService.Stub implements D
private final SessionMonitor mSessionMonitor;
private int mCurrentUserId;
private boolean mTracingEnabled;
private int mLastSystemKey = -1;
private final TileRequestTracker mTileRequestTracker;
@@ -905,6 +907,8 @@ public class StatusBarManagerService extends IStatusBarService.Stub implements D
return;
}
mLastSystemKey = key;
if (mBar != null) {
try {
mBar.handleSystemKey(key);
@@ -913,6 +917,14 @@ public class StatusBarManagerService extends IStatusBarService.Stub implements D
}
}
@Override
@TestApi
public int getLastSystemKey() {
enforceStatusBar();
return mLastSystemKey;
}
@Override
public void showPinningEnterExitToast(boolean entering) throws RemoteException {
if (mBar != null) {