Fix adb shell not being able to access /data.
Use thin font on values-16, only on Superuser-light theme.
Better logging.
Change-Id: I9d7dd0d9b0a006f1703926f65f8a5ea3f0e29bd2
chown(outfile, daemon_from_uid, 0);
chown(infile, daemon_from_uid, 0);
chown(errfile, daemon_from_uid, 0);
+ chmod(outfile, 0660);
+ chmod(infile, 0660);
+ chmod(errfile, 0660);
// ack
write_int(fd, 1);
int outfd = open(outfile, O_WRONLY);
if (outfd <= 0) {
- PLOGE("outfd");
+ PLOGE("outfd daemon %s", outfile);
goto done;
}
int errfd = open(errfile, O_WRONLY);
if (errfd <= 0) {
- PLOGE("errfd");
+ PLOGE("errfd daemon %s", errfile);
goto done;
}
int infd = open(infile, O_RDONLY);
if (infd <= 0) {
- PLOGE("infd");
+ PLOGE("infd daemon %s", infile);
goto done;
}
int outfd = open(outfile, O_RDONLY);
if (outfd <= 0) {
- PLOGE("outfd");
+ PLOGE("outfd %s ", outfile);
exit(-1);
}
int errfd = open(errfile, O_RDONLY);
if (errfd <= 0) {
- PLOGE("errfd");
+ PLOGE("errfd %s", errfile);
exit(-1);
}
int infd = open(infile, O_WRONLY);
if (infd <= 0) {
- PLOGE("infd");
+ PLOGE("infd %s", infile);
exit(-1);
}
return 0;
}
+static int is_api_18() {
+ char sdk_ver[PROPERTY_VALUE_MAX];
+ char *data = read_file("/system/build.prop");
+ get_property(data, sdk_ver, "ro.build.version.sdk", "0");
+ int ver = atoi(sdk_ver);
+ free(data);
+ return ver >= 18;
+}
+
int main(int argc, char *argv[]) {
// start up in daemon mode if prompted
if (argc == 2 && strcmp(argv[1], "--daemon") == 0) {
return run_daemon();
}
- if (geteuid() != AID_ROOT && getuid() != AID_ROOT) {
+ // attempt to use the daemon client if not root,
+ // or this is api 18 and adb shell (/data is not readable even as root)
+ if ((geteuid() != AID_ROOT && getuid() != AID_ROOT) || (is_api_18() && getuid() == AID_SHELL)) {
// attempt to connect to daemon...
LOGD("starting daemon client %d %d", getuid(), geteuid());
return connect_daemon(argc, argv);
#define str(a) #a
#ifndef VERSION_CODE
-#define VERSION_CODE 10
+#define VERSION_CODE 12
#endif
#define VERSION xstr(VERSION_CODE) " " REQUESTOR
--- /dev/null
+<resources xmlns:android="http://schemas.android.com/apk/res/android">
+
+ <style name="AndroidTheme" parent="@android:style/Theme.Holo.Light.DarkActionBar">
+ <item name="android:textViewStyle">@style/RobotoTextViewStyle</item>
+ <item name="android:buttonStyle">@style/RobotoButtonStyle</item>
+ </style>
+
+ <style name="RobotoTextViewStyle" parent="android:Widget.TextView">
+ <item name="android:fontFamily">sans-serif-light</item>
+ </style>
+
+ <style name="RobotoButtonStyle" parent="android:Widget.Holo.Button">
+ <item name="android:fontFamily">sans-serif-light</item>
+ </style>
+</resources>
File zip = getFileStreamPath("superuser.zip");
ZipOutputStream zout = new ZipOutputStream(new FileOutputStream(zip));
doEntry(zout, "assets/update-binary", "META-INF/com/google/android/update-binary");
- zout.close();
-
- zout = new ZipOutputStream(new FileOutputStream(zip));
doEntry(zout, "assets/install-recovery.sh", "install-recovery.sh");
zout.close();
import android.util.Log;
public class SuHelper {
- public static String CURRENT_VERSION = "10";
+ public static String CURRENT_VERSION = "12";
public static void checkSu(Context context) throws Exception {
Process p = Runtime.getRuntime().exec("su -v");
String result = Settings.readToEnd(p.getInputStream());