Skip to content

Commit 875f064

Browse files
jsharkeyAndroid (Google) Code Review
authored andcommitted
Merge "Move SystemUI out of system UID."
2 parents 27e2fa4 + 35be756 commit 875f064

File tree

6 files changed

+67
-9
lines changed

6 files changed

+67
-9
lines changed

core/java/android/service/wallpaper/WallpaperService.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ public class Engine {
140140
boolean mIsCreating;
141141
boolean mDrawingAllowed;
142142
boolean mOffsetsChanged;
143+
boolean mFixedSizeAllowed;
143144
int mWidth;
144145
int mHeight;
145146
int mFormat;
@@ -211,7 +212,7 @@ public boolean isCreating() {
211212

212213
@Override
213214
public void setFixedSize(int width, int height) {
214-
if (Process.myUid() != Process.SYSTEM_UID) {
215+
if (!mFixedSizeAllowed) {
215216
// Regular apps can't do this. It can only work for
216217
// certain designs of window animations, so you can't
217218
// rely on it.
@@ -385,7 +386,12 @@ public void setOffsetNotificationsEnabled(boolean enabled) {
385386
updateSurface(false, false, false);
386387
}
387388
}
388-
389+
390+
/** {@hide} */
391+
public void setFixedSizeAllowed(boolean allowed) {
392+
mFixedSizeAllowed = allowed;
393+
}
394+
389395
/**
390396
* Called once to initialize the engine. After returning, the
391397
* engine's surface will be created by the framework.

core/res/AndroidManifest.xml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -737,6 +737,14 @@
737737
android:label="@string/permlab_removeTasks"
738738
android:description="@string/permdesc_removeTasks" />
739739

740+
<!-- Allows an application to start any activity, regardless of permission
741+
protection or exported state. @hide -->
742+
<permission android:name="android.permission.START_ANY_ACTIVITY"
743+
android:permissionGroup="android.permission-group.SYSTEM_TOOLS"
744+
android:protectionLevel="signature"
745+
android:label="@string/permlab_startAnyActivity"
746+
android:description="@string/permdesc_startAnyActivity" />
747+
740748
<!-- @hide Change the screen compatibility mode of applications -->
741749
<permission android:name="android.permission.SET_SCREEN_COMPATIBILITY"
742750
android:permissionGroup="android.permission-group.SYSTEM_TOOLS"

core/res/res/values/strings.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -538,6 +538,11 @@
538538
tasks and kill their apps. Malicious apps may disrupt
539539
the behavior of other apps.</string>
540540

541+
<!-- Title of an application permission, allowing an application to start any activity, regardless of permission protection or exported state. -->
542+
<string name="permlab_startAnyActivity">start any activity</string>
543+
<!-- Description of an application permission, allowing an application to start any activity, regardless of permission protection or exported state. -->
544+
<string name="permdesc_startAnyActivity">Allows the app to start any activity, regardless of permission protection or exported state.</string>
545+
541546
<!-- Title of an application permission, allowing control of app screen compatibility mode -->
542547
<string name="permlab_setScreenCompatibility">set screen compatibility</string>
543548
<!-- Description of an application permission, allowing control of app screen compatibility mode -->

packages/SystemUI/AndroidManifest.xml

Lines changed: 34 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,44 @@
11
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
22
package="com.android.systemui"
3-
coreApp="true"
4-
android:sharedUserId="android.uid.system"
5-
android:process="system"
6-
>
3+
coreApp="true">
4+
5+
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
6+
7+
<uses-permission android:name="android.permission.INJECT_EVENTS" />
8+
<uses-permission android:name="android.permission.WRITE_SETTINGS" />
79

810
<uses-permission android:name="android.permission.STATUS_BAR_SERVICE" />
11+
<uses-permission android:name="android.permission.STATUS_BAR" />
12+
<uses-permission android:name="android.permission.EXPAND_STATUS_BAR" />
13+
14+
<!-- Networking and telephony -->
915
<uses-permission android:name="android.permission.BLUETOOTH" />
1016
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
11-
<uses-permission android:name="android.permission.GET_TASKS" />
17+
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
18+
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
19+
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
20+
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
21+
22+
<!-- Physical hardware -->
1223
<uses-permission android:name="android.permission.MANAGE_USB" />
24+
<uses-permission android:name="android.permission.DEVICE_POWER" />
25+
<uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" />
26+
<uses-permission android:name="android.permission.UPDATE_DEVICE_STATS" />
27+
28+
<!-- ActivityManager -->
29+
<uses-permission android:name="android.permission.GET_TASKS" />
30+
<uses-permission android:name="android.permission.REORDER_TASKS" />
31+
<uses-permission android:name="android.permission.REMOVE_TASKS" />
32+
<uses-permission android:name="android.permission.STOP_APP_SWITCHES" />
33+
<uses-permission android:name="android.permission.SET_SCREEN_COMPATIBILITY" />
34+
<uses-permission android:name="android.permission.START_ANY_ACTIVITY" />
35+
36+
<!-- WindowManager -->
37+
<uses-permission android:name="android.permission.INTERNAL_SYSTEM_WINDOW" />
38+
<uses-permission android:name="android.permission.READ_FRAME_BUFFER" />
39+
<uses-permission android:name="android.permission.MANAGE_APP_TOKENS" />
40+
<uses-permission android:name="android.permission.SET_ORIENTATION" />
41+
<uses-permission android:name="android.permission.DISABLE_KEYGUARD" />
1342

1443
<application
1544
android:persistent="true"

packages/SystemUI/src/com/android/systemui/ImageWallpaper.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,11 @@ public void onReceive(Context context, Intent intent) {
155155
}
156156
}
157157

158+
public DrawableEngine() {
159+
super();
160+
setFixedSizeAllowed(true);
161+
}
162+
158163
@Override
159164
public void onCreate(SurfaceHolder surfaceHolder) {
160165
if (DEBUG) {

services/java/com/android/server/am/ActivityStack.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@
1616

1717
package com.android.server.am;
1818

19+
import static android.Manifest.permission.START_ANY_ACTIVITY;
20+
import static android.content.pm.PackageManager.PERMISSION_GRANTED;
21+
1922
import com.android.internal.app.HeavyWeightSwitcherActivity;
2023
import com.android.internal.os.BatteryStatsImpl;
2124
import com.android.server.am.ActivityManagerService.PendingActivityLaunch;
@@ -2407,9 +2410,11 @@ final int startActivityLocked(IApplicationThread caller,
24072410
return err;
24082411
}
24092412

2410-
final int perm = mService.checkComponentPermission(aInfo.permission, callingPid,
2413+
final int startAnyPerm = mService.checkPermission(
2414+
START_ANY_ACTIVITY, callingPid, callingUid);
2415+
final int componentPerm = mService.checkComponentPermission(aInfo.permission, callingPid,
24112416
callingUid, aInfo.applicationInfo.uid, aInfo.exported);
2412-
if (perm != PackageManager.PERMISSION_GRANTED) {
2417+
if (startAnyPerm != PERMISSION_GRANTED && componentPerm != PERMISSION_GRANTED) {
24132418
if (resultRecord != null) {
24142419
sendActivityResultLocked(-1,
24152420
resultRecord, resultWho, requestCode,

0 commit comments

Comments
 (0)