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

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

Merge "Fix some crashes that are happening in the system process."

parents 585f727b 8e8d65ff
Loading
Loading
Loading
Loading
+17 −6
Original line number Original line Diff line number Diff line
@@ -332,20 +332,31 @@ public class ApplicationErrorReport implements Parcelable {
            exceptionMessage = tr.getMessage();
            exceptionMessage = tr.getMessage();


            // Populate fields with the "root cause" exception
            // Populate fields with the "root cause" exception
            Throwable rootTr = tr;
            while (tr.getCause() != null) {
            while (tr.getCause() != null) {
                tr = tr.getCause();
                tr = tr.getCause();
                if (tr.getStackTrace() != null && tr.getStackTrace().length > 0) {
                    rootTr = tr;
                }
                String msg = tr.getMessage();
                String msg = tr.getMessage();
                if (msg != null && msg.length() > 0) {
                if (msg != null && msg.length() > 0) {
                    exceptionMessage = msg;
                    exceptionMessage = msg;
                }
                }
            }
            }


            exceptionClassName = tr.getClass().getName();
            exceptionClassName = rootTr.getClass().getName();
            StackTraceElement trace = tr.getStackTrace()[0];
            if (rootTr.getStackTrace().length > 0) {
                StackTraceElement trace = rootTr.getStackTrace()[0];
                throwFileName = trace.getFileName();
                throwFileName = trace.getFileName();
                throwClassName = trace.getClassName();
                throwClassName = trace.getClassName();
                throwMethodName = trace.getMethodName();
                throwMethodName = trace.getMethodName();
                throwLineNumber = trace.getLineNumber();
                throwLineNumber = trace.getLineNumber();
            } else {
                throwFileName = "unknown";
                throwClassName = "unknown";
                throwMethodName = "unknown";
                throwLineNumber = 0;
            }
        }
        }


        /**
        /**
+5 −4
Original line number Original line Diff line number Diff line
@@ -1689,7 +1689,7 @@ public abstract class Uri implements Parcelable, Comparable<Uri> {
                    return HierarchicalUri.readFrom(in);
                    return HierarchicalUri.readFrom(in);
            }
            }


            throw new AssertionError("Unknown URI type: " + type);
            throw new IllegalArgumentException("Unknown URI type: " + type);
        }
        }


        public Uri[] newArray(int size) {
        public Uri[] newArray(int size) {
@@ -1996,7 +1996,7 @@ public abstract class Uri implements Parcelable, Comparable<Uri> {
                parcel.writeInt(Representation.DECODED);
                parcel.writeInt(Representation.DECODED);
                parcel.writeString(decoded);
                parcel.writeString(decoded);
            } else {
            } else {
                throw new AssertionError();
                throw new IllegalArgumentException("Neither encoded nor decoded");
            }
            }
        }
        }
    }
    }
@@ -2037,7 +2037,8 @@ public abstract class Uri implements Parcelable, Comparable<Uri> {
                case Representation.DECODED:
                case Representation.DECODED:
                    return fromDecoded(parcel.readString());
                    return fromDecoded(parcel.readString());
                default:
                default:
                    throw new AssertionError();
                    throw new IllegalArgumentException("Unknown representation: "
                            + representation);
            }
            }
        }
        }


@@ -2221,7 +2222,7 @@ public abstract class Uri implements Parcelable, Comparable<Uri> {
                case Representation.DECODED:
                case Representation.DECODED:
                    return fromDecoded(parcel.readString());
                    return fromDecoded(parcel.readString());
                default:
                default:
                    throw new AssertionError();
                    throw new IllegalArgumentException("Bad representation: " + representation);
            }
            }
        }
        }


+6 −0
Original line number Original line Diff line number Diff line
@@ -19,6 +19,7 @@ package com.android.internal.os;
import static android.os.Process.*;
import static android.os.Process.*;


import android.os.Process;
import android.os.Process;
import android.os.StrictMode;
import android.os.SystemClock;
import android.os.SystemClock;
import android.util.Slog;
import android.util.Slog;


@@ -798,6 +799,10 @@ public class ProcessStats {
    }
    }
    
    
    private String readFile(String file, char endChar) {
    private String readFile(String file, char endChar) {
        // Permit disk reads here, as /proc/meminfo isn't really "on
        // disk" and should be fast.  TODO: make BlockGuard ignore
        // /proc/ and /sys/ files perhaps?
        StrictMode.ThreadPolicy savedPolicy = StrictMode.allowThreadDiskReads();
        FileInputStream is = null;
        FileInputStream is = null;
        try {
        try {
            is = new FileInputStream(file);
            is = new FileInputStream(file);
@@ -822,6 +827,7 @@ public class ProcessStats {
                } catch (java.io.IOException e) {
                } catch (java.io.IOException e) {
                }
                }
            }
            }
            StrictMode.setThreadPolicy(savedPolicy);
        }
        }
        return null;
        return null;
    }
    }
+6 −5
Original line number Original line Diff line number Diff line
@@ -276,11 +276,13 @@ final class ActivityStack {
        public void handleMessage(Message msg) {
        public void handleMessage(Message msg) {
            switch (msg.what) {
            switch (msg.what) {
                case SLEEP_TIMEOUT_MSG: {
                case SLEEP_TIMEOUT_MSG: {
                    synchronized (mService) {
                        if (mService.isSleeping()) {
                        if (mService.isSleeping()) {
                            Slog.w(TAG, "Sleep timeout!  Sleeping now.");
                            Slog.w(TAG, "Sleep timeout!  Sleeping now.");
                            mSleepTimeout = true;
                            mSleepTimeout = true;
                            checkReadyForSleepLocked();
                            checkReadyForSleepLocked();
                        }
                        }
                    }
                } break;
                } break;
                case PAUSE_TIMEOUT_MSG: {
                case PAUSE_TIMEOUT_MSG: {
                    IBinder token = (IBinder)msg.obj;
                    IBinder token = (IBinder)msg.obj;
@@ -775,7 +777,6 @@ final class ActivityStack {
        if (mService.mShuttingDown) {
        if (mService.mShuttingDown) {
            mService.notifyAll();
            mService.notifyAll();
        }
        }

    }
    }
    
    
    public final Bitmap screenshotActivities(ActivityRecord who) {
    public final Bitmap screenshotActivities(ActivityRecord who) {
+6 −0
Original line number Original line Diff line number Diff line
@@ -8736,6 +8736,12 @@ public class WindowManagerService extends IWindowManager.Stub
            return;
            return;
        }
        }


        if (mDisplay == null || !mPolicy.isScreenOn()) {
            // No need to freeze the screen before the system is ready or if
            // the screen is off.
            return;
        }

        mScreenFrozenLock.acquire();
        mScreenFrozenLock.acquire();


        mDisplayFrozen = true;
        mDisplayFrozen = true;