Merge "Introduce INPUT_CONSUMER permission for InputConsumer" into rvc-d1-dev am: c3347f92cd
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/12937360 Change-Id: I63a88a3b97c87490551535b58042cc210e998944
This commit is contained in:
@@ -5056,6 +5056,10 @@
|
||||
<permission android:name="android.permission.ACCESS_LOCUS_ID_USAGE_STATS"
|
||||
android:protectionLevel="signature|appPredictor" />
|
||||
|
||||
<!-- @hide Allows an application to create/destroy input consumer. -->
|
||||
<permission android:name="android.permission.INPUT_CONSUMER"
|
||||
android:protectionLevel="signature" />
|
||||
|
||||
<!-- Attribution for Country Detector. -->
|
||||
<attribution android:tag="CountryDetector" android:label="@string/country_detector"/>
|
||||
<!-- Attribution for Location service. -->
|
||||
|
||||
@@ -113,6 +113,7 @@
|
||||
<uses-permission android:name="android.permission.SET_ORIENTATION" />
|
||||
<uses-permission android:name="android.permission.DISABLE_KEYGUARD" />
|
||||
<uses-permission android:name="android.permission.MONITOR_INPUT" />
|
||||
<uses-permission android:name="android.permission.INPUT_CONSUMER" />
|
||||
|
||||
<!-- DreamManager -->
|
||||
<uses-permission android:name="android.permission.READ_DREAM_STATE" />
|
||||
|
||||
@@ -219,6 +219,11 @@ final class InputMonitor {
|
||||
|
||||
WindowManagerPolicy.InputConsumer createInputConsumer(Looper looper, String name,
|
||||
InputEventReceiver.Factory inputEventReceiverFactory) {
|
||||
if (!name.contentEquals(INPUT_CONSUMER_NAVIGATION)) {
|
||||
throw new IllegalArgumentException("Illegal input consumer : " + name
|
||||
+ ", display: " + mDisplayId);
|
||||
}
|
||||
|
||||
if (mInputConsumers.containsKey(name)) {
|
||||
throw new IllegalStateException("Existing input consumer found with name: " + name
|
||||
+ ", display: " + mDisplayId);
|
||||
@@ -248,6 +253,11 @@ final class InputMonitor {
|
||||
// stack, and we need FLAG_NOT_TOUCH_MODAL to ensure other events fall through
|
||||
consumer.mWindowHandle.layoutParamsFlags |= FLAG_NOT_TOUCH_MODAL;
|
||||
break;
|
||||
case INPUT_CONSUMER_RECENTS_ANIMATION:
|
||||
break;
|
||||
default:
|
||||
throw new IllegalArgumentException("Illegal input consumer : " + name
|
||||
+ ", display: " + mDisplayId);
|
||||
}
|
||||
addInputConsumer(name, consumer);
|
||||
}
|
||||
@@ -459,9 +469,6 @@ final class InputMonitor {
|
||||
mDisplayContent.forAllWindows(this,
|
||||
true /* traverseTopToBottom */);
|
||||
|
||||
if (mAddWallpaperInputConsumerHandle) {
|
||||
mWallpaperInputConsumer.show(mInputTransaction, 0);
|
||||
}
|
||||
if (!mUpdateInputWindowsImmediately) {
|
||||
mDisplayContent.getPendingTransaction().merge(mInputTransaction);
|
||||
mDisplayContent.scheduleAnimation();
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
package com.android.server.wm;
|
||||
|
||||
import static android.Manifest.permission.CONTROL_REMOTE_APP_TRANSITION_ANIMATIONS;
|
||||
import static android.Manifest.permission.INPUT_CONSUMER;
|
||||
import static android.Manifest.permission.INTERNAL_SYSTEM_WINDOW;
|
||||
import static android.Manifest.permission.MANAGE_ACTIVITY_STACKS;
|
||||
import static android.Manifest.permission.MANAGE_APP_TOKENS;
|
||||
@@ -5886,6 +5887,11 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
@Override
|
||||
public void createInputConsumer(IBinder token, String name, int displayId,
|
||||
InputChannel inputChannel) {
|
||||
if (!mAtmInternal.isCallerRecents(Binder.getCallingUid())
|
||||
&& mContext.checkCallingOrSelfPermission(INPUT_CONSUMER) != PERMISSION_GRANTED) {
|
||||
throw new SecurityException("createInputConsumer requires INPUT_CONSUMER permission");
|
||||
}
|
||||
|
||||
synchronized (mGlobalLock) {
|
||||
DisplayContent display = mRoot.getDisplayContent(displayId);
|
||||
if (display != null) {
|
||||
@@ -5897,6 +5903,11 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
|
||||
@Override
|
||||
public boolean destroyInputConsumer(String name, int displayId) {
|
||||
if (!mAtmInternal.isCallerRecents(Binder.getCallingUid())
|
||||
&& mContext.checkCallingOrSelfPermission(INPUT_CONSUMER) != PERMISSION_GRANTED) {
|
||||
throw new SecurityException("destroyInputConsumer requires INPUT_CONSUMER permission");
|
||||
}
|
||||
|
||||
synchronized (mGlobalLock) {
|
||||
DisplayContent display = mRoot.getDisplayContent(displayId);
|
||||
if (display != null) {
|
||||
|
||||
Reference in New Issue
Block a user