forked from M66B/cm10-fxp-extended
-
Notifications
You must be signed in to change notification settings - Fork 0
/
superuser_koush_superuser.patch
221 lines (211 loc) · 9.28 KB
/
superuser_koush_superuser.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
diff --git a/Superuser/project.properties b/Superuser/project.properties
index dd3bbf7..6113adc 100644
--- a/Superuser/project.properties
+++ b/Superuser/project.properties
@@ -11,6 +11,6 @@
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
# Project target.
-target=android-17
+target=android-16
android.library.reference.1=../../Widgets/Widgets
ndk.executable=ndk-build
diff --git a/Superuser/res/layout-land/log_item.xml b/Superuser/res/layout-land/log_item.xml
index 082af7c..8ca6500 100644
--- a/Superuser/res/layout-land/log_item.xml
+++ b/Superuser/res/layout-land/log_item.xml
@@ -3,8 +3,6 @@
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
- android:paddingEnd="@dimen/section_padding"
- android:paddingStart="@dimen/section_padding"
android:paddingBottom="@dimen/log_item_padding"
android:paddingTop="@dimen/log_item_padding" >
diff --git a/Superuser/res/values/styles.xml b/Superuser/res/values/styles.xml
index 39ca7f2..4748c43 100644
--- a/Superuser/res/values/styles.xml
+++ b/Superuser/res/values/styles.xml
@@ -66,9 +66,9 @@
<style name="SuperuserDarkActivity" parent="@style/AppDarkActivityTheme" />
<!-- Want to switch to the dark theme? Change these three styles to Dark. -->
- <style name="RequestTheme" parent="RequestThemeLight" />
- <style name="Superuser" parent="SuperuserLight" />
- <style name="SuperuserActivity" parent="SuperuserLightActivity" />
+ <style name="RequestTheme" parent="RequestThemeDark" />
+ <style name="Superuser" parent="SuperuserDark" />
+ <style name="SuperuserActivity" parent="SuperuserDarkActivity" />
<style name="AppActivityBaseTheme" parent="SuperuserLight" />
<style name="AppDarkActivityBaseTheme" parent="SuperuserDark" />
diff --git a/Superuser/src/com/koushikdutta/superuser/Helper.java b/Superuser/src/com/koushikdutta/superuser/Helper.java
index 2ef91a3..9a13da9 100644
--- a/Superuser/src/com/koushikdutta/superuser/Helper.java
+++ b/Superuser/src/com/koushikdutta/superuser/Helper.java
@@ -23,7 +23,6 @@ import android.content.Context;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.graphics.drawable.Drawable;
-import android.os.UserManager;
import com.koushikdutta.superuser.util.ImageCache;
@@ -43,28 +42,4 @@ public class Helper {
return null;
}
- @SuppressLint("NewApi")
- public static boolean supportsMultipleUsers(Context context) {
- final UserManager um = (UserManager) context.getSystemService(Context.USER_SERVICE);
- try {
- Method supportsMultipleUsers = UserManager.class.getMethod("supportsMultipleUsers");
- return (Boolean)supportsMultipleUsers.invoke(um);
- }
- catch (Exception ex) {
- return false;
- }
- }
-
- @SuppressLint("NewApi")
- public static boolean isAdminUser(Context context) {
- final UserManager um = (UserManager) context.getSystemService(Context.USER_SERVICE);
- try {
- Method getUserHandle = UserManager.class.getMethod("getUserHandle");
- int userHandle = (Integer)getUserHandle.invoke(um);
- return userHandle == 0;
- }
- catch (Exception ex) {
- return true;
- }
- }
}
diff --git a/Superuser/src/com/koushikdutta/superuser/SettingsFragmentInternal.java b/Superuser/src/com/koushikdutta/superuser/SettingsFragmentInternal.java
index c596c8d..12f417c 100644
--- a/Superuser/src/com/koushikdutta/superuser/SettingsFragmentInternal.java
+++ b/Superuser/src/com/koushikdutta/superuser/SettingsFragmentInternal.java
@@ -182,68 +182,6 @@ public class SettingsFragmentInternal extends BetterListFragmentInternal {
}
}).setAttrDrawable(R.attr.toggleIcon);
- if (Settings.getMultiuserMode(getActivity()) != Settings.MULTIUSER_MODE_NONE) {
- addItem(R.string.security, new ListItem(this, R.string.multiuser_policy, 0) {
- void update() {
- int res = -1;
- switch (Settings.getMultiuserMode(getActivity())) {
- case Settings.MULTIUSER_MODE_OWNER_MANAGED:
- res = R.string.multiuser_owner_managed_summary;
- break;
- case Settings.MULTIUSER_MODE_OWNER_ONLY:
- res = R.string.multiuser_owner_only_summary;
- break;
- case Settings.MULTIUSER_MODE_USER:
- res = R.string.multiuser_user_summary;
- break;
- }
-
- if (!Helper.isAdminUser(getActivity())) {
- setEnabled(false);
- String s = "";
- if (res != -1)
- s = getString(res) + "\n";
- setSummary(s + getString(R.string.multiuser_require_owner));
- }
- else {
- if (res != -1)
- setSummary(res);
- }
- }
-
- {
- update();
- }
-
- @Override
- public void onClick(View view) {
- super.onClick(view);
-
- AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
- builder.setTitle(R.string.multiuser_policy);
- String[] items = new String[] { getString(R.string.multiuser_owner_only), getString(R.string.multiuser_owner_managed), getString(R.string.multiuser_user) };
- builder.setItems(items, new OnClickListener() {
- @Override
- public void onClick(DialogInterface dialog, int which) {
- switch (which) {
- case 0:
- Settings.setMultiuserMode(getActivity(), Settings.MULTIUSER_MODE_OWNER_ONLY);
- break;
- case 1:
- Settings.setMultiuserMode(getActivity(), Settings.MULTIUSER_MODE_OWNER_MANAGED);
- break;
- case 2:
- Settings.setMultiuserMode(getActivity(), Settings.MULTIUSER_MODE_USER);
- break;
- }
- update();
- }
- });
- builder.create().show();
- }
- }).setAttrDrawable(R.attr.multiuserIcon);
- }
-
addItem(R.string.security, new ListItem(this, R.string.declared_permission, R.string.declared_permission_summary) {
@Override
public void onClick(View view) {
diff --git a/Superuser/src/com/koushikdutta/superuser/util/Settings.java b/Superuser/src/com/koushikdutta/superuser/util/Settings.java
index 3e1d58b..ea6b240 100755
--- a/Superuser/src/com/koushikdutta/superuser/util/Settings.java
+++ b/Superuser/src/com/koushikdutta/superuser/util/Settings.java
@@ -256,59 +256,9 @@ public class Settings {
private static final String MULTIUSER_VALUE_USER = "user";
public static final int getMultiuserMode(Context context) {
- if (Build.VERSION.SDK_INT < 17)
return MULTIUSER_MODE_NONE;
-
- if (!Helper.supportsMultipleUsers(context))
- return MULTIUSER_MODE_NONE;
-
- try {
- String mode;
- if (Helper.isAdminUser(context)) {
- File file = context.getFileStreamPath("multiuser_mode");
- mode = readFile(file);
- }
- else {
- Process p = Runtime.getRuntime().exec("su -u");
- mode = readToEnd(p.getInputStream()).trim();
- }
-
- if (MULTIUSER_VALUE_OWNER_MANAGED.equals(mode))
- return MULTIUSER_MODE_OWNER_MANAGED;
- if (MULTIUSER_VALUE_USER.equals(mode))
- return MULTIUSER_MODE_USER;
- if (MULTIUSER_VALUE_OWNER_ONLY.equals(mode))
- return MULTIUSER_MODE_OWNER_ONLY;
- }
- catch (Exception e) {
- }
- return MULTIUSER_MODE_OWNER_ONLY;
- }
-
- public static void setMultiuserMode(Context context, int mode) {
- if (!Helper.isAdminUser(context))
- return;
- try {
- File file = context.getFileStreamPath("multiuser_mode");
- switch (mode) {
- case MULTIUSER_MODE_OWNER_MANAGED:
- writeFile(file, MULTIUSER_VALUE_OWNER_MANAGED);
- break;
- case MULTIUSER_MODE_USER:
- writeFile(file, MULTIUSER_VALUE_USER);
- break;
- case MULTIUSER_MODE_NONE:
- file.delete();
- break;
- default:
- writeFile(file, MULTIUSER_VALUE_OWNER_ONLY);
- break;
- }
- }
- catch (Exception ex) {
- }
}
-
+
public static final int SUPERUSER_ACCESS_DISABLED = 0;
public static final int SUPERUSER_ACCESS_APPS_ONLY = 1;