OSDN Git Service

Switch to new Superuser
authorKoushik Dutta <koushd@gmail.com>
Thu, 28 Feb 2013 22:49:24 +0000 (14:49 -0800)
committerChih-Wei Huang <cwhuang@linux.org.tw>
Wed, 25 Sep 2013 03:05:57 +0000 (11:05 +0800)
Change-Id: I9d91392ad6fbc9953d19059ab59b91d214c00e0c

Android.mk
AndroidManifest.xml
proguard.flags
res/xml/settings_headers.xml
src/com/android/settings/cyanogenmod/superuser/MultitaskSuRequestActivity.java [new file with mode: 0644]
src/com/android/settings/cyanogenmod/superuser/NotifyActivity.java [new file with mode: 0644]
src/com/android/settings/cyanogenmod/superuser/PolicyNativeFragment.java [new file with mode: 0644]
src/com/android/settings/cyanogenmod/superuser/RequestActivity.java [new file with mode: 0644]
src/com/android/settings/cyanogenmod/superuser/SuReceiver.java [new file with mode: 0644]

index c8b81dc..4902183 100644 (file)
@@ -13,6 +13,12 @@ LOCAL_CERTIFICATE := platform
 
 LOCAL_PROGUARD_FLAG_FILES := proguard.flags
 
+LOCAL_AAPT_INCLUDE_ALL_RESOURCES := true
+LOCAL_AAPT_FLAGS := --extra-packages com.koushikdutta.superuser:com.koushikdutta.widgets --auto-add-overlay
+
+LOCAL_SRC_FILES += $(call all-java-files-under,../../../external/koush/Superuser/Superuser/src) $(call all-java-files-under,../../../external/koush/Widgets/Widgets/src)
+LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res $(LOCAL_PATH)/../../../external/koush/Widgets/Widgets/res $(LOCAL_PATH)/../../../external/koush/Superuser/Superuser/res
+
 LOCAL_AAPT_FLAGS += -c zz_ZZ
 
 include $(BUILD_PACKAGE)
index c39e838..cb80893 100644 (file)
     <uses-permission android:name="android.permission.SET_TIME" />
     <uses-permission android:name="android.permission.ACCESS_NOTIFICATIONS" />
 
+    <permission
+        android:name="android.permission.REQUEST_SUPERUSER"
+        android:protectionLevel="signature" />
+    <permission
+        android:name="android.permission.REPORT_SUPERUSER"
+        android:protectionLevel="signature" />
+
+    <permission-group
+        android:name="android.permission-group.SUPERUSER"
+        android:description="@string/superuser_description_more"
+        android:icon="@drawable/ic_action_permission"
+        android:label="@string/superuser"
+        android:priority="10000" />
+
+    <permission
+        android:name="android.permission.ACCESS_SUPERUSER"
+        android:description="@string/superuser_description_more"
+        android:icon="@drawable/ic_action_permission"
+        android:label="@string/superuser_description"
+        android:logo="@drawable/ic_action_permission"
+        android:permissionGroup="android.permission-group.SUPERUSER"
+        android:protectionLevel="dangerous" />
+
     <application android:label="@string/settings_label"
             android:icon="@mipmap/ic_launcher_settings"
             android:taskAffinity=""
             android:requiredForAllUsers="true"
             android:supportsRtl="true">
 
+        <!-- Only system/su can open this activity -->
+        <!-- This activity will then call the MultitaskSuRequestActivity to create a new task stack -->
+        <activity
+            android:name=".cyanogenmod.superuser.RequestActivity"
+            android:configChanges="keyboardHidden|orientation|screenSize"
+            android:label="@string/superuser"
+            android:launchMode="singleTask"
+            android:excludeFromRecents="true"
+            android:permission="android.permission.REQUEST_SUPERUSER"
+            android:process=":superuser"
+            android:taskAffinity="com.android.settings.superuser"
+            android:theme="@style/RequestThemeDark" />
+        <!-- Only system/su can open this activity -->
+        <!-- This is activity is started in multiuser mode when the user invoking su -->
+        <!-- is not the device owner (user id 0). -->
+        <activity
+            android:name=".cyanogenmod.superuser.NotifyActivity"
+            android:configChanges="keyboardHidden|orientation|screenSize"
+            android:label="@string/superuser"
+            android:launchMode="singleTask"
+            android:excludeFromRecents="true"
+            android:permission="android.permission.REQUEST_SUPERUSER"
+            android:process=":superuser"
+            android:taskAffinity="com.android.settings.superuser"
+            android:theme="@style/RequestThemeDark" />
+
+        <!-- Multiple instances of this activity can be running for multiple su requests -->
+        <activity
+            android:name=".cyanogenmod.superuser.MultitaskSuRequestActivity"
+            android:configChanges="keyboardHidden|orientation|screenSize"
+            android:excludeFromRecents="true"
+            android:exported="false"
+            android:label="@string/request"
+            android:process=":superuser"
+            android:taskAffinity="com.android.settings.superuser"
+            android:theme="@style/RequestThemeDark" />
+
+        <receiver
+            android:name=".cyanogenmod.superuser.SuReceiver"
+            android:permission="android.permission.REPORT_SUPERUSER" />
+
+
         <!-- Settings -->
 
         <activity android:name="Settings"
index 548fac0..26cbaf8 100644 (file)
@@ -14,6 +14,8 @@
 -keep class com.android.settings.fuelgauge.*
 -keep class com.android.settings.users.*
 -keep class com.android.settings.NotificationStation
+-keep class com.koushikdutta.**
+-keep class com.android.settings.cyanogenmod.superuser.**
 
 # Keep click responders
 -keepclassmembers class com.android.settings.inputmethod.UserDictionaryAddWordActivity {
index 2a91847..c940661 100644 (file)
     <header android:id="@+id/system_section"
         android:title="@string/header_category_system" />
 
+    <!-- Superuser -->
+    <header
+        android:id="@+id/superuser"
+        android:fragment="com.android.settings.cyanogenmod.superuser.PolicyNativeFragment"
+        android:icon="@drawable/ic_action_permission"
+        android:title="@string/superuser" />
+
     <!-- Date & Time -->
     <header
         android:id="@+id/date_time_settings"
diff --git a/src/com/android/settings/cyanogenmod/superuser/MultitaskSuRequestActivity.java b/src/com/android/settings/cyanogenmod/superuser/MultitaskSuRequestActivity.java
new file mode 100644 (file)
index 0000000..0103076
--- /dev/null
@@ -0,0 +1,4 @@
+package com.android.settings.cyanogenmod.superuser;
+
+public class MultitaskSuRequestActivity extends com.koushikdutta.superuser.MultitaskSuRequestActivity {
+}
\ No newline at end of file
diff --git a/src/com/android/settings/cyanogenmod/superuser/NotifyActivity.java b/src/com/android/settings/cyanogenmod/superuser/NotifyActivity.java
new file mode 100644 (file)
index 0000000..23aa6a7
--- /dev/null
@@ -0,0 +1,4 @@
+package com.android.settings.cyanogenmod.superuser;
+
+public class NotifyActivity extends com.koushikdutta.superuser.NotifyActivity {
+}
\ No newline at end of file
diff --git a/src/com/android/settings/cyanogenmod/superuser/PolicyNativeFragment.java b/src/com/android/settings/cyanogenmod/superuser/PolicyNativeFragment.java
new file mode 100644 (file)
index 0000000..1c74543
--- /dev/null
@@ -0,0 +1,4 @@
+package com.android.settings.cyanogenmod.superuser;
+
+public class PolicyNativeFragment extends com.koushikdutta.superuser.PolicyNativeFragment {
+}
\ No newline at end of file
diff --git a/src/com/android/settings/cyanogenmod/superuser/RequestActivity.java b/src/com/android/settings/cyanogenmod/superuser/RequestActivity.java
new file mode 100644 (file)
index 0000000..e6deca4
--- /dev/null
@@ -0,0 +1,4 @@
+package com.android.settings.cyanogenmod.superuser;
+
+public class RequestActivity extends com.koushikdutta.superuser.RequestActivity {
+}
\ No newline at end of file
diff --git a/src/com/android/settings/cyanogenmod/superuser/SuReceiver.java b/src/com/android/settings/cyanogenmod/superuser/SuReceiver.java
new file mode 100644 (file)
index 0000000..c4f9174
--- /dev/null
@@ -0,0 +1,4 @@
+package com.android.settings.cyanogenmod.superuser;
+
+public class SuReceiver extends com.koushikdutta.superuser.SuReceiver {
+}
\ No newline at end of file