Loading core/java/android/view/IWindowManager.aidl +1 −2 Original line number Original line Diff line number Diff line Loading @@ -738,9 +738,8 @@ interface IWindowManager * If invoked through a package other than a launcher app, returns an empty list. * If invoked through a package other than a launcher app, returns an empty list. * * * @param displayId the id of the logical display * @param displayId the id of the logical display * @param packageName the name of the calling package */ */ List<DisplayInfo> getPossibleDisplayInfo(int displayId, String packageName); List<DisplayInfo> getPossibleDisplayInfo(int displayId); /** /** * Called to show global actions. * Called to show global actions. Loading core/java/android/view/WindowManagerImpl.java +1 −1 Original line number Original line Diff line number Diff line Loading @@ -366,7 +366,7 @@ public final class WindowManagerImpl implements WindowManager { List<DisplayInfo> possibleDisplayInfos; List<DisplayInfo> possibleDisplayInfos; try { try { possibleDisplayInfos = WindowManagerGlobal.getWindowManagerService() possibleDisplayInfos = WindowManagerGlobal.getWindowManagerService() .getPossibleDisplayInfo(displayId, mContext.getPackageName()); .getPossibleDisplayInfo(displayId); } catch (RemoteException e) { } catch (RemoteException e) { throw e.rethrowFromSystemServer(); throw e.rethrowFromSystemServer(); } } Loading services/core/java/com/android/server/wm/WindowManagerService.java +4 −29 Original line number Original line Diff line number Diff line Loading @@ -8940,14 +8940,14 @@ public class WindowManagerService extends IWindowManager.Stub } } @Override @Override public List<DisplayInfo> getPossibleDisplayInfo(int displayId, String packageName) { public List<DisplayInfo> getPossibleDisplayInfo(int displayId) { final int callingUid = Binder.getCallingUid(); final int callingUid = Binder.getCallingUid(); final long origId = Binder.clearCallingIdentity(); final long origId = Binder.clearCallingIdentity(); try { try { synchronized (mGlobalLock) { synchronized (mGlobalLock) { if (packageName == null || !isRecentsComponent(packageName, callingUid)) { if (!mAtmService.isCallerRecents(callingUid)) { Slog.e(TAG, "Unable to verify uid for package " + packageName Slog.e(TAG, "Unable to verify uid for getPossibleDisplayInfo" + " for getPossibleMaximumWindowMetrics"); + " on uid " + callingUid); return new ArrayList<>(); return new ArrayList<>(); } } Loading @@ -8965,31 +8965,6 @@ public class WindowManagerService extends IWindowManager.Stub return mPossibleDisplayInfoMapper.getPossibleDisplayInfos(displayId); return mPossibleDisplayInfoMapper.getPossibleDisplayInfos(displayId); } } /** * Returns {@code true} when the calling package is the recents component. */ boolean isRecentsComponent(@NonNull String callingPackageName, int callingUid) { String recentsPackage; try { String recentsComponent = mContext.getResources().getString( R.string.config_recentsComponentName); if (recentsComponent == null) { return false; } recentsPackage = ComponentName.unflattenFromString(recentsComponent).getPackageName(); } catch (Resources.NotFoundException e) { Slog.e(TAG, "Unable to verify if recents component", e); return false; } try { return callingUid == mContext.getPackageManager().getPackageUid(callingPackageName, 0) && callingPackageName.equals(recentsPackage); } catch (PackageManager.NameNotFoundException e) { Slog.e(TAG, "Unable to verify if recents component", e); return false; } } void grantEmbeddedWindowFocus(Session session, IBinder focusToken, boolean grantFocus) { void grantEmbeddedWindowFocus(Session session, IBinder focusToken, boolean grantFocus) { synchronized (mGlobalLock) { synchronized (mGlobalLock) { final EmbeddedWindowController.EmbeddedWindow embeddedWindow = final EmbeddedWindowController.EmbeddedWindow embeddedWindow = Loading Loading
core/java/android/view/IWindowManager.aidl +1 −2 Original line number Original line Diff line number Diff line Loading @@ -738,9 +738,8 @@ interface IWindowManager * If invoked through a package other than a launcher app, returns an empty list. * If invoked through a package other than a launcher app, returns an empty list. * * * @param displayId the id of the logical display * @param displayId the id of the logical display * @param packageName the name of the calling package */ */ List<DisplayInfo> getPossibleDisplayInfo(int displayId, String packageName); List<DisplayInfo> getPossibleDisplayInfo(int displayId); /** /** * Called to show global actions. * Called to show global actions. Loading
core/java/android/view/WindowManagerImpl.java +1 −1 Original line number Original line Diff line number Diff line Loading @@ -366,7 +366,7 @@ public final class WindowManagerImpl implements WindowManager { List<DisplayInfo> possibleDisplayInfos; List<DisplayInfo> possibleDisplayInfos; try { try { possibleDisplayInfos = WindowManagerGlobal.getWindowManagerService() possibleDisplayInfos = WindowManagerGlobal.getWindowManagerService() .getPossibleDisplayInfo(displayId, mContext.getPackageName()); .getPossibleDisplayInfo(displayId); } catch (RemoteException e) { } catch (RemoteException e) { throw e.rethrowFromSystemServer(); throw e.rethrowFromSystemServer(); } } Loading
services/core/java/com/android/server/wm/WindowManagerService.java +4 −29 Original line number Original line Diff line number Diff line Loading @@ -8940,14 +8940,14 @@ public class WindowManagerService extends IWindowManager.Stub } } @Override @Override public List<DisplayInfo> getPossibleDisplayInfo(int displayId, String packageName) { public List<DisplayInfo> getPossibleDisplayInfo(int displayId) { final int callingUid = Binder.getCallingUid(); final int callingUid = Binder.getCallingUid(); final long origId = Binder.clearCallingIdentity(); final long origId = Binder.clearCallingIdentity(); try { try { synchronized (mGlobalLock) { synchronized (mGlobalLock) { if (packageName == null || !isRecentsComponent(packageName, callingUid)) { if (!mAtmService.isCallerRecents(callingUid)) { Slog.e(TAG, "Unable to verify uid for package " + packageName Slog.e(TAG, "Unable to verify uid for getPossibleDisplayInfo" + " for getPossibleMaximumWindowMetrics"); + " on uid " + callingUid); return new ArrayList<>(); return new ArrayList<>(); } } Loading @@ -8965,31 +8965,6 @@ public class WindowManagerService extends IWindowManager.Stub return mPossibleDisplayInfoMapper.getPossibleDisplayInfos(displayId); return mPossibleDisplayInfoMapper.getPossibleDisplayInfos(displayId); } } /** * Returns {@code true} when the calling package is the recents component. */ boolean isRecentsComponent(@NonNull String callingPackageName, int callingUid) { String recentsPackage; try { String recentsComponent = mContext.getResources().getString( R.string.config_recentsComponentName); if (recentsComponent == null) { return false; } recentsPackage = ComponentName.unflattenFromString(recentsComponent).getPackageName(); } catch (Resources.NotFoundException e) { Slog.e(TAG, "Unable to verify if recents component", e); return false; } try { return callingUid == mContext.getPackageManager().getPackageUid(callingPackageName, 0) && callingPackageName.equals(recentsPackage); } catch (PackageManager.NameNotFoundException e) { Slog.e(TAG, "Unable to verify if recents component", e); return false; } } void grantEmbeddedWindowFocus(Session session, IBinder focusToken, boolean grantFocus) { void grantEmbeddedWindowFocus(Session session, IBinder focusToken, boolean grantFocus) { synchronized (mGlobalLock) { synchronized (mGlobalLock) { final EmbeddedWindowController.EmbeddedWindow embeddedWindow = final EmbeddedWindowController.EmbeddedWindow embeddedWindow = Loading