Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 54f9b1ee authored by Dianne Hackborn's avatar Dianne Hackborn Committed by Android (Google) Code Review
Browse files

Merge "Fix issue #18942959: Phone getting stuck then restarts after unplugging...

Merge "Fix issue #18942959: Phone getting stuck then restarts after unplugging from Audi" into lmp-mr1-dev
parents cce8db2c b3d4cb36
Loading
Loading
Loading
Loading
+4 −4
Original line number Original line Diff line number Diff line
@@ -15,7 +15,7 @@ import java.nio.charset.CoderResult;
import java.nio.charset.CodingErrorAction;
import java.nio.charset.CodingErrorAction;


public class FastPrintWriter extends PrintWriter {
public class FastPrintWriter extends PrintWriter {
    private static Writer sDummyWriter = new Writer() {
    private static class DummyWriter extends Writer {
        @Override
        @Override
        public void close() throws IOException {
        public void close() throws IOException {
            UnsupportedOperationException ex
            UnsupportedOperationException ex
@@ -100,7 +100,7 @@ public class FastPrintWriter extends PrintWriter {
     *             if {@code out} is {@code null}.
     *             if {@code out} is {@code null}.
     */
     */
    public FastPrintWriter(OutputStream out, boolean autoFlush, int bufferLen) {
    public FastPrintWriter(OutputStream out, boolean autoFlush, int bufferLen) {
        super(sDummyWriter, autoFlush);
        super(new DummyWriter(), autoFlush);
        if (out == null) {
        if (out == null) {
            throw new NullPointerException("out is null");
            throw new NullPointerException("out is null");
        }
        }
@@ -169,7 +169,7 @@ public class FastPrintWriter extends PrintWriter {
     *             if {@code wr} is {@code null}.
     *             if {@code wr} is {@code null}.
     */
     */
    public FastPrintWriter(Writer wr, boolean autoFlush, int bufferLen) {
    public FastPrintWriter(Writer wr, boolean autoFlush, int bufferLen) {
        super(sDummyWriter, autoFlush);
        super(new DummyWriter(), autoFlush);
        if (wr == null) {
        if (wr == null) {
            throw new NullPointerException("wr is null");
            throw new NullPointerException("wr is null");
        }
        }
@@ -212,7 +212,7 @@ public class FastPrintWriter extends PrintWriter {
     *             if {@code pr} is {@code null}.
     *             if {@code pr} is {@code null}.
     */
     */
    public FastPrintWriter(Printer pr, int bufferLen) {
    public FastPrintWriter(Printer pr, int bufferLen) {
        super(sDummyWriter, true);
        super(new DummyWriter(), true);
        if (pr == null) {
        if (pr == null) {
            throw new NullPointerException("pr is null");
            throw new NullPointerException("pr is null");
        }
        }
+13 −13
Original line number Original line Diff line number Diff line
@@ -205,8 +205,8 @@ public class SystemConfig {
            }
            }


            if (!parser.getName().equals("permissions") && !parser.getName().equals("config")) {
            if (!parser.getName().equals("permissions") && !parser.getName().equals("config")) {
                throw new XmlPullParserException("Unexpected start tag: found " + parser.getName() +
                throw new XmlPullParserException("Unexpected start tag in " + permFile
                        ", expected 'permissions' or 'config'");
                        + ": found " + parser.getName() + ", expected 'permissions' or 'config'");
            }
            }


            while (true) {
            while (true) {
@@ -222,7 +222,7 @@ public class SystemConfig {
                        int gid = android.os.Process.getGidForName(gidStr);
                        int gid = android.os.Process.getGidForName(gidStr);
                        mGlobalGids = appendInt(mGlobalGids, gid);
                        mGlobalGids = appendInt(mGlobalGids, gid);
                    } else {
                    } else {
                        Slog.w(TAG, "<group> without gid at "
                        Slog.w(TAG, "<group> without gid in " + permFile + " at "
                                + parser.getPositionDescription());
                                + parser.getPositionDescription());
                    }
                    }


@@ -231,7 +231,7 @@ public class SystemConfig {
                } else if ("permission".equals(name) && !onlyFeatures) {
                } else if ("permission".equals(name) && !onlyFeatures) {
                    String perm = parser.getAttributeValue(null, "name");
                    String perm = parser.getAttributeValue(null, "name");
                    if (perm == null) {
                    if (perm == null) {
                        Slog.w(TAG, "<permission> without name at "
                        Slog.w(TAG, "<permission> without name in " + permFile + " at "
                                + parser.getPositionDescription());
                                + parser.getPositionDescription());
                        XmlUtils.skipCurrentTag(parser);
                        XmlUtils.skipCurrentTag(parser);
                        continue;
                        continue;
@@ -242,14 +242,14 @@ public class SystemConfig {
                } else if ("assign-permission".equals(name) && !onlyFeatures) {
                } else if ("assign-permission".equals(name) && !onlyFeatures) {
                    String perm = parser.getAttributeValue(null, "name");
                    String perm = parser.getAttributeValue(null, "name");
                    if (perm == null) {
                    if (perm == null) {
                        Slog.w(TAG, "<assign-permission> without name at "
                        Slog.w(TAG, "<assign-permission> without name in " + permFile + " at "
                                + parser.getPositionDescription());
                                + parser.getPositionDescription());
                        XmlUtils.skipCurrentTag(parser);
                        XmlUtils.skipCurrentTag(parser);
                        continue;
                        continue;
                    }
                    }
                    String uidStr = parser.getAttributeValue(null, "uid");
                    String uidStr = parser.getAttributeValue(null, "uid");
                    if (uidStr == null) {
                    if (uidStr == null) {
                        Slog.w(TAG, "<assign-permission> without uid at "
                        Slog.w(TAG, "<assign-permission> without uid in " + permFile + " at "
                                + parser.getPositionDescription());
                                + parser.getPositionDescription());
                        XmlUtils.skipCurrentTag(parser);
                        XmlUtils.skipCurrentTag(parser);
                        continue;
                        continue;
@@ -257,7 +257,7 @@ public class SystemConfig {
                    int uid = Process.getUidForName(uidStr);
                    int uid = Process.getUidForName(uidStr);
                    if (uid < 0) {
                    if (uid < 0) {
                        Slog.w(TAG, "<assign-permission> with unknown uid \""
                        Slog.w(TAG, "<assign-permission> with unknown uid \""
                                + uidStr + "\" at "
                                + uidStr + "  in " + permFile + " at "
                                + parser.getPositionDescription());
                                + parser.getPositionDescription());
                        XmlUtils.skipCurrentTag(parser);
                        XmlUtils.skipCurrentTag(parser);
                        continue;
                        continue;
@@ -275,10 +275,10 @@ public class SystemConfig {
                    String lname = parser.getAttributeValue(null, "name");
                    String lname = parser.getAttributeValue(null, "name");
                    String lfile = parser.getAttributeValue(null, "file");
                    String lfile = parser.getAttributeValue(null, "file");
                    if (lname == null) {
                    if (lname == null) {
                        Slog.w(TAG, "<library> without name at "
                        Slog.w(TAG, "<library> without name in " + permFile + " at "
                                + parser.getPositionDescription());
                                + parser.getPositionDescription());
                    } else if (lfile == null) {
                    } else if (lfile == null) {
                        Slog.w(TAG, "<library> without file at "
                        Slog.w(TAG, "<library> without file in " + permFile + " at "
                                + parser.getPositionDescription());
                                + parser.getPositionDescription());
                    } else {
                    } else {
                        //Log.i(TAG, "Got library " + lname + " in " + lfile);
                        //Log.i(TAG, "Got library " + lname + " in " + lfile);
@@ -297,7 +297,7 @@ public class SystemConfig {
                        allowed = !"true".equals(notLowRam);
                        allowed = !"true".equals(notLowRam);
                    }
                    }
                    if (fname == null) {
                    if (fname == null) {
                        Slog.w(TAG, "<feature> without name at "
                        Slog.w(TAG, "<feature> without name in " + permFile + " at "
                                + parser.getPositionDescription());
                                + parser.getPositionDescription());
                    } else if (allowed) {
                    } else if (allowed) {
                        //Log.i(TAG, "Got feature " + fname);
                        //Log.i(TAG, "Got feature " + fname);
@@ -311,7 +311,7 @@ public class SystemConfig {
                } else if ("unavailable-feature".equals(name)) {
                } else if ("unavailable-feature".equals(name)) {
                    String fname = parser.getAttributeValue(null, "name");
                    String fname = parser.getAttributeValue(null, "name");
                    if (fname == null) {
                    if (fname == null) {
                        Slog.w(TAG, "<unavailable-feature> without name at "
                        Slog.w(TAG, "<unavailable-feature> without name in " + permFile + " at "
                                + parser.getPositionDescription());
                                + parser.getPositionDescription());
                    } else {
                    } else {
                        mUnavailableFeatures.add(fname);
                        mUnavailableFeatures.add(fname);
@@ -322,7 +322,7 @@ public class SystemConfig {
                } else if ("allow-in-power-save".equals(name) && !onlyFeatures) {
                } else if ("allow-in-power-save".equals(name) && !onlyFeatures) {
                    String pkgname = parser.getAttributeValue(null, "package");
                    String pkgname = parser.getAttributeValue(null, "package");
                    if (pkgname == null) {
                    if (pkgname == null) {
                        Slog.w(TAG, "<allow-in-power-save> without package at "
                        Slog.w(TAG, "<allow-in-power-save> without package in " + permFile + " at "
                                + parser.getPositionDescription());
                                + parser.getPositionDescription());
                    } else {
                    } else {
                        mAllowInPowerSave.add(pkgname);
                        mAllowInPowerSave.add(pkgname);
@@ -333,7 +333,7 @@ public class SystemConfig {
                } else if ("fixed-ime-app".equals(name) && !onlyFeatures) {
                } else if ("fixed-ime-app".equals(name) && !onlyFeatures) {
                    String pkgname = parser.getAttributeValue(null, "package");
                    String pkgname = parser.getAttributeValue(null, "package");
                    if (pkgname == null) {
                    if (pkgname == null) {
                        Slog.w(TAG, "<fixed-ime-app> without package at "
                        Slog.w(TAG, "<fixed-ime-app> without package in " + permFile + " at "
                                + parser.getPositionDescription());
                                + parser.getPositionDescription());
                    } else {
                    } else {
                        mFixedImeApps.add(pkgname);
                        mFixedImeApps.add(pkgname);
+8 −18
Original line number Original line Diff line number Diff line
@@ -2998,6 +2998,10 @@ public final class ActivityManagerService extends ActivityManagerNative
                instructionSet = VMRuntime.getInstructionSet(app.info.primaryCpuAbi);
                instructionSet = VMRuntime.getInstructionSet(app.info.primaryCpuAbi);
            }
            }
            app.gids = gids;
            app.requiredAbi = requiredAbi;
            app.instructionSet = instructionSet;
            // Start the process.  It will either succeed and return a result containing
            // Start the process.  It will either succeed and return a result containing
            // the PID of the new process, or else throw a RuntimeException.
            // the PID of the new process, or else throw a RuntimeException.
            boolean isActivityProcess = (entryPoint == null);
            boolean isActivityProcess = (entryPoint == null);
@@ -3028,7 +3032,11 @@ public final class ActivityManagerService extends ActivityManagerNative
            StringBuilder buf = mStringBuilder;
            StringBuilder buf = mStringBuilder;
            buf.setLength(0);
            buf.setLength(0);
            buf.append("Start proc ");
            buf.append("Start proc ");
            buf.append(startResult.pid);
            buf.append(':');
            buf.append(app.processName);
            buf.append(app.processName);
            buf.append('/');
            UserHandle.formatUid(buf, uid);
            if (!isActivityProcess) {
            if (!isActivityProcess) {
                buf.append(" [");
                buf.append(" [");
                buf.append(entryPoint);
                buf.append(entryPoint);
@@ -3040,23 +3048,6 @@ public final class ActivityManagerService extends ActivityManagerNative
                buf.append(" ");
                buf.append(" ");
                buf.append(hostingNameStr);
                buf.append(hostingNameStr);
            }
            }
            buf.append(": pid=");
            buf.append(startResult.pid);
            buf.append(" uid=");
            buf.append(uid);
            buf.append(" gids={");
            if (gids != null) {
                for (int gi=0; gi<gids.length; gi++) {
                    if (gi != 0) buf.append(", ");
                    buf.append(gids[gi]);
                }
            }
            buf.append("}");
            if (requiredAbi != null) {
                buf.append(" abi=");
                buf.append(requiredAbi);
            }
            Slog.i(TAG, buf.toString());
            Slog.i(TAG, buf.toString());
            app.setPid(startResult.pid);
            app.setPid(startResult.pid);
            app.usingWrapper = startResult.usingWrapper;
            app.usingWrapper = startResult.usingWrapper;
@@ -5327,7 +5318,6 @@ public final class ActivityManagerService extends ActivityManagerNative
            int callingPid = Binder.getCallingPid();
            int callingPid = Binder.getCallingPid();
            if (callingPid == Process.myPid()) {
            if (callingPid == Process.myPid()) {
                //  Yeah, um, no.
                //  Yeah, um, no.
                Slog.w(TAG, "Can't addPackageDependency on system process");
                return;
                return;
            }
            }
            ProcessRecord proc;
            ProcessRecord proc;
+39 −43
Original line number Original line Diff line number Diff line
@@ -108,7 +108,6 @@ final class CoreSettingsObserver extends ContentObserver {
        for (Map.Entry<String, Class<?>> entry : map.entrySet()) {
        for (Map.Entry<String, Class<?>> entry : map.entrySet()) {
            String setting = entry.getKey();
            String setting = entry.getKey();
            Class<?> type = entry.getValue();
            Class<?> type = entry.getValue();
            try {
            if (type == String.class) {
            if (type == String.class) {
                final String value;
                final String value;
                if (map == sSecureSettingToTypeMap) {
                if (map == sSecureSettingToTypeMap) {
@@ -122,37 +121,34 @@ final class CoreSettingsObserver extends ContentObserver {
            } else if (type == int.class) {
            } else if (type == int.class) {
                final int value;
                final int value;
                if (map == sSecureSettingToTypeMap) {
                if (map == sSecureSettingToTypeMap) {
                        value = Settings.Secure.getInt(context.getContentResolver(), setting);
                    value = Settings.Secure.getInt(context.getContentResolver(), setting, 0);
                } else if (map == sSystemSettingToTypeMap) {
                } else if (map == sSystemSettingToTypeMap) {
                        value = Settings.System.getInt(context.getContentResolver(), setting);
                    value = Settings.System.getInt(context.getContentResolver(), setting, 0);
                } else {
                } else {
                        value = Settings.Global.getInt(context.getContentResolver(), setting);
                    value = Settings.Global.getInt(context.getContentResolver(), setting, 0);
                }
                }
                snapshot.putInt(setting, value);
                snapshot.putInt(setting, value);
            } else if (type == float.class) {
            } else if (type == float.class) {
                final float value;
                final float value;
                if (map == sSecureSettingToTypeMap) {
                if (map == sSecureSettingToTypeMap) {
                        value = Settings.Secure.getFloat(context.getContentResolver(), setting);
                    value = Settings.Secure.getFloat(context.getContentResolver(), setting, 0);
                } else if (map == sSystemSettingToTypeMap) {
                } else if (map == sSystemSettingToTypeMap) {
                        value = Settings.System.getFloat(context.getContentResolver(), setting);
                    value = Settings.System.getFloat(context.getContentResolver(), setting, 0);
                } else {
                } else {
                        value = Settings.Global.getFloat(context.getContentResolver(), setting);
                    value = Settings.Global.getFloat(context.getContentResolver(), setting, 0);
                }
                }
                snapshot.putFloat(setting, value);
                snapshot.putFloat(setting, value);
            } else if (type == long.class) {
            } else if (type == long.class) {
                final long value;
                final long value;
                if (map == sSecureSettingToTypeMap) {
                if (map == sSecureSettingToTypeMap) {
                        value = Settings.Secure.getLong(context.getContentResolver(), setting);
                    value = Settings.Secure.getLong(context.getContentResolver(), setting, 0);
                } else if (map == sSystemSettingToTypeMap) {
                } else if (map == sSystemSettingToTypeMap) {
                        value = Settings.System.getLong(context.getContentResolver(), setting);
                    value = Settings.System.getLong(context.getContentResolver(), setting, 0);
                } else {
                } else {
                        value = Settings.Global.getLong(context.getContentResolver(), setting);
                    value = Settings.Global.getLong(context.getContentResolver(), setting, 0);
                }
                }
                snapshot.putLong(setting, value);
                snapshot.putLong(setting, value);
            }
            }
            } catch (SettingNotFoundException snfe) {
                Log.w(LOG_TAG, "Cannot find setting \"" + setting + "\"", snfe);
            }
        }
        }
    }
    }
}
}
+14 −1
Original line number Original line Diff line number Diff line
@@ -64,6 +64,9 @@ final class ProcessRecord {
    ProcessStats.ProcessState baseProcessTracker;
    ProcessStats.ProcessState baseProcessTracker;
    BatteryStatsImpl.Uid.Proc curProcBatteryStats;
    BatteryStatsImpl.Uid.Proc curProcBatteryStats;
    int pid;                    // The process of this application; 0 if none
    int pid;                    // The process of this application; 0 if none
    int[] gids;                 // The gids this process was launched with
    String requiredAbi;         // The ABI this process was launched with
    String instructionSet;      // The instruction set this process was launched with
    boolean starting;           // True if the process is being started
    boolean starting;           // True if the process is being started
    long lastActivityTime;      // For managing the LRU list
    long lastActivityTime;      // For managing the LRU list
    long lastPssTime;           // Last time we retrieved PSS data
    long lastPssTime;           // Last time we retrieved PSS data
@@ -183,7 +186,17 @@ final class ProcessRecord {
        if (uid != info.uid) {
        if (uid != info.uid) {
            pw.print(" ISOLATED uid="); pw.print(uid);
            pw.print(" ISOLATED uid="); pw.print(uid);
        }
        }
        pw.println();
        pw.print(" gids={");
        if (gids != null) {
            for (int gi=0; gi<gids.length; gi++) {
                if (gi != 0) pw.print(", ");
                pw.print(gids[gi]);

            }
        }
        pw.println("}");
        pw.print(prefix); pw.print("requiredAbi="); pw.print(requiredAbi);
                pw.print(" instructionSet="); pw.println(instructionSet);
        if (info.className != null) {
        if (info.className != null) {
            pw.print(prefix); pw.print("class="); pw.println(info.className);
            pw.print(prefix); pw.print("class="); pw.println(info.className);
        }
        }
Loading