Merge "Add permission check in notifyWakingUp/GoingToSleep" into udc-dev am: fa25a8e1d1 am: 262c068657
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/22964860 Change-Id: Id66b2a889380bf258dc11c51ddbbe7cc79c6abe1 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -82,6 +82,7 @@ import android.os.IBinder;
|
|||||||
import android.os.IInterface;
|
import android.os.IInterface;
|
||||||
import android.os.IRemoteCallback;
|
import android.os.IRemoteCallback;
|
||||||
import android.os.ParcelFileDescriptor;
|
import android.os.ParcelFileDescriptor;
|
||||||
|
import android.os.Process;
|
||||||
import android.os.RemoteCallbackList;
|
import android.os.RemoteCallbackList;
|
||||||
import android.os.RemoteException;
|
import android.os.RemoteException;
|
||||||
import android.os.ResultReceiver;
|
import android.os.ResultReceiver;
|
||||||
@@ -2514,6 +2515,7 @@ public class WallpaperManagerService extends IWallpaperManager.Stub
|
|||||||
* Propagate a wake event to the wallpaper engine(s).
|
* Propagate a wake event to the wallpaper engine(s).
|
||||||
*/
|
*/
|
||||||
public void notifyWakingUp(int x, int y, @NonNull Bundle extras) {
|
public void notifyWakingUp(int x, int y, @NonNull Bundle extras) {
|
||||||
|
checkCallerIsSystemOrSystemUi();
|
||||||
synchronized (mLock) {
|
synchronized (mLock) {
|
||||||
if (mIsLockscreenLiveWallpaperEnabled) {
|
if (mIsLockscreenLiveWallpaperEnabled) {
|
||||||
for (WallpaperData data : getActiveWallpapers()) {
|
for (WallpaperData data : getActiveWallpapers()) {
|
||||||
@@ -2551,6 +2553,7 @@ public class WallpaperManagerService extends IWallpaperManager.Stub
|
|||||||
* Propagate a sleep event to the wallpaper engine(s).
|
* Propagate a sleep event to the wallpaper engine(s).
|
||||||
*/
|
*/
|
||||||
public void notifyGoingToSleep(int x, int y, @NonNull Bundle extras) {
|
public void notifyGoingToSleep(int x, int y, @NonNull Bundle extras) {
|
||||||
|
checkCallerIsSystemOrSystemUi();
|
||||||
synchronized (mLock) {
|
synchronized (mLock) {
|
||||||
if (mIsLockscreenLiveWallpaperEnabled) {
|
if (mIsLockscreenLiveWallpaperEnabled) {
|
||||||
for (WallpaperData data : getActiveWallpapers()) {
|
for (WallpaperData data : getActiveWallpapers()) {
|
||||||
@@ -3684,6 +3687,14 @@ public class WallpaperManagerService extends IWallpaperManager.Stub
|
|||||||
mActivityManager.getPackageImportance(callingPackage) == IMPORTANCE_FOREGROUND);
|
mActivityManager.getPackageImportance(callingPackage) == IMPORTANCE_FOREGROUND);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Check that the caller is either system_server or systemui */
|
||||||
|
private void checkCallerIsSystemOrSystemUi() {
|
||||||
|
if (Binder.getCallingUid() != Process.myUid() && mContext.checkCallingPermission(
|
||||||
|
android.Manifest.permission.STATUS_BAR_SERVICE) != PERMISSION_GRANTED) {
|
||||||
|
throw new SecurityException("Access denied: only system processes can call this");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Certain user types do not support wallpapers (e.g. managed profiles). The check is
|
* Certain user types do not support wallpapers (e.g. managed profiles). The check is
|
||||||
* implemented through through the OP_WRITE_WALLPAPER AppOp.
|
* implemented through through the OP_WRITE_WALLPAPER AppOp.
|
||||||
|
|||||||
Reference in New Issue
Block a user