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

Commit 8277ea35 authored by Marco Ballesio's avatar Marco Ballesio Committed by Automerger Merge Worker
Browse files

freezer: handle exception in locks file format am: 911519f2

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/13534713

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: If3c8c1c8097f34cc83ae5d5728b40a91d23257ce
parents fd85bb9c 911519f2
Loading
Loading
Loading
Loading
+8 −3
Original line number Diff line number Diff line
@@ -1405,7 +1405,7 @@ public class Process {
     *
     * @hide
     */
    public static boolean hasFileLocks(int pid) throws IOException {
    public static boolean hasFileLocks(int pid) throws Exception {
        BufferedReader br = null;

        try {
@@ -1417,9 +1417,14 @@ public class Process {

                for (int i = 0; i < 5 && st.hasMoreTokens(); i++) {
                    String str = st.nextToken();
                    try {
                        if (i == 4 && Integer.parseInt(str) == pid) {
                            return true;
                        }
                    } catch (NumberFormatException nfe) {
                        throw new Exception("Exception parsing /proc/locks at \" "
                                + line +  " \", token #" + i);
                    }
                }
            }

+2 −2
Original line number Diff line number Diff line
@@ -1114,7 +1114,7 @@ public final class CachedAppOptimizer {
                    }
                    return;
                }
            } catch (IOException e) {
            } catch (Exception e) {
                Slog.e(TAG_AM, "Not freezing. Unable to check file locks for " + name + "(" + pid
                        + "): " + e);
                return;
@@ -1192,7 +1192,7 @@ public final class CachedAppOptimizer {
                        unfreezeAppLocked(proc);
                    }
                }
            } catch (IOException e) {
            } catch (Exception e) {
                Slog.e(TAG_AM, "Unable to check file locks for " + name + "(" + pid + "): " + e);
                synchronized (mAm) {
                    unfreezeAppLocked(proc);