Loading packages/CrashRecovery/services/module/java/com/android/server/PackageWatchdog.java +30 −17 Original line number Diff line number Diff line Loading @@ -2074,15 +2074,19 @@ public class PackageWatchdog { bootMitigationCounts.put(observer.name, observer.getBootMitigationCount()); } FileOutputStream fileStream = null; ObjectOutputStream objectStream = null; try { FileOutputStream fileStream = new FileOutputStream(new File(filePath)); ObjectOutputStream objectStream = new ObjectOutputStream(fileStream); fileStream = new FileOutputStream(new File(filePath)); objectStream = new ObjectOutputStream(fileStream); objectStream.writeObject(bootMitigationCounts); objectStream.flush(); objectStream.close(); fileStream.close(); } catch (Exception e) { Slog.i(TAG, "Could not save observers metadata to file: " + e); return; } finally { IoUtils.closeQuietly(objectStream); IoUtils.closeQuietly(fileStream); } } Loading Loading @@ -2233,14 +2237,26 @@ public class PackageWatchdog { void readAllObserversBootMitigationCountIfNecessary(String filePath) { File metadataFile = new File(filePath); if (metadataFile.exists()) { FileInputStream fileStream = null; ObjectInputStream objectStream = null; HashMap<String, Integer> bootMitigationCounts = null; try { FileInputStream fileStream = new FileInputStream(metadataFile); ObjectInputStream objectStream = new ObjectInputStream(fileStream); HashMap<String, Integer> bootMitigationCounts = fileStream = new FileInputStream(metadataFile); objectStream = new ObjectInputStream(fileStream); bootMitigationCounts = (HashMap<String, Integer>) objectStream.readObject(); objectStream.close(); fileStream.close(); } catch (Exception e) { Slog.i(TAG, "Could not read observer metadata file: " + e); return; } finally { IoUtils.closeQuietly(objectStream); IoUtils.closeQuietly(fileStream); } if (bootMitigationCounts == null || bootMitigationCounts.isEmpty()) { Slog.i(TAG, "No observer in metadata file"); return; } for (int i = 0; i < mAllObservers.size(); i++) { final ObserverInternal observer = mAllObservers.valueAt(i); if (bootMitigationCounts.containsKey(observer.name)) { Loading @@ -2248,9 +2264,6 @@ public class PackageWatchdog { bootMitigationCounts.get(observer.name)); } } } catch (Exception e) { Slog.i(TAG, "Could not read observer metadata file: " + e); } } } } Loading packages/CrashRecovery/services/platform/java/com/android/server/PackageWatchdog.java +30 −17 Original line number Diff line number Diff line Loading @@ -2021,15 +2021,19 @@ public class PackageWatchdog { bootMitigationCounts.put(observer.name, observer.getBootMitigationCount()); } FileOutputStream fileStream = null; ObjectOutputStream objectStream = null; try { FileOutputStream fileStream = new FileOutputStream(new File(filePath)); ObjectOutputStream objectStream = new ObjectOutputStream(fileStream); fileStream = new FileOutputStream(new File(filePath)); objectStream = new ObjectOutputStream(fileStream); objectStream.writeObject(bootMitigationCounts); objectStream.flush(); objectStream.close(); fileStream.close(); } catch (Exception e) { Slog.i(TAG, "Could not save observers metadata to file: " + e); return; } finally { IoUtils.closeQuietly(objectStream); IoUtils.closeQuietly(fileStream); } } Loading Loading @@ -2180,14 +2184,26 @@ public class PackageWatchdog { void readAllObserversBootMitigationCountIfNecessary(String filePath) { File metadataFile = new File(filePath); if (metadataFile.exists()) { FileInputStream fileStream = null; ObjectInputStream objectStream = null; HashMap<String, Integer> bootMitigationCounts = null; try { FileInputStream fileStream = new FileInputStream(metadataFile); ObjectInputStream objectStream = new ObjectInputStream(fileStream); HashMap<String, Integer> bootMitigationCounts = fileStream = new FileInputStream(metadataFile); objectStream = new ObjectInputStream(fileStream); bootMitigationCounts = (HashMap<String, Integer>) objectStream.readObject(); objectStream.close(); fileStream.close(); } catch (Exception e) { Slog.i(TAG, "Could not read observer metadata file: " + e); return; } finally { IoUtils.closeQuietly(objectStream); IoUtils.closeQuietly(fileStream); } if (bootMitigationCounts == null || bootMitigationCounts.isEmpty()) { Slog.i(TAG, "No observer in metadata file"); return; } for (int i = 0; i < mAllObservers.size(); i++) { final ObserverInternal observer = mAllObservers.valueAt(i); if (bootMitigationCounts.containsKey(observer.name)) { Loading @@ -2195,9 +2211,6 @@ public class PackageWatchdog { bootMitigationCounts.get(observer.name)); } } } catch (Exception e) { Slog.i(TAG, "Could not read observer metadata file: " + e); } } } } Loading Loading
packages/CrashRecovery/services/module/java/com/android/server/PackageWatchdog.java +30 −17 Original line number Diff line number Diff line Loading @@ -2074,15 +2074,19 @@ public class PackageWatchdog { bootMitigationCounts.put(observer.name, observer.getBootMitigationCount()); } FileOutputStream fileStream = null; ObjectOutputStream objectStream = null; try { FileOutputStream fileStream = new FileOutputStream(new File(filePath)); ObjectOutputStream objectStream = new ObjectOutputStream(fileStream); fileStream = new FileOutputStream(new File(filePath)); objectStream = new ObjectOutputStream(fileStream); objectStream.writeObject(bootMitigationCounts); objectStream.flush(); objectStream.close(); fileStream.close(); } catch (Exception e) { Slog.i(TAG, "Could not save observers metadata to file: " + e); return; } finally { IoUtils.closeQuietly(objectStream); IoUtils.closeQuietly(fileStream); } } Loading Loading @@ -2233,14 +2237,26 @@ public class PackageWatchdog { void readAllObserversBootMitigationCountIfNecessary(String filePath) { File metadataFile = new File(filePath); if (metadataFile.exists()) { FileInputStream fileStream = null; ObjectInputStream objectStream = null; HashMap<String, Integer> bootMitigationCounts = null; try { FileInputStream fileStream = new FileInputStream(metadataFile); ObjectInputStream objectStream = new ObjectInputStream(fileStream); HashMap<String, Integer> bootMitigationCounts = fileStream = new FileInputStream(metadataFile); objectStream = new ObjectInputStream(fileStream); bootMitigationCounts = (HashMap<String, Integer>) objectStream.readObject(); objectStream.close(); fileStream.close(); } catch (Exception e) { Slog.i(TAG, "Could not read observer metadata file: " + e); return; } finally { IoUtils.closeQuietly(objectStream); IoUtils.closeQuietly(fileStream); } if (bootMitigationCounts == null || bootMitigationCounts.isEmpty()) { Slog.i(TAG, "No observer in metadata file"); return; } for (int i = 0; i < mAllObservers.size(); i++) { final ObserverInternal observer = mAllObservers.valueAt(i); if (bootMitigationCounts.containsKey(observer.name)) { Loading @@ -2248,9 +2264,6 @@ public class PackageWatchdog { bootMitigationCounts.get(observer.name)); } } } catch (Exception e) { Slog.i(TAG, "Could not read observer metadata file: " + e); } } } } Loading
packages/CrashRecovery/services/platform/java/com/android/server/PackageWatchdog.java +30 −17 Original line number Diff line number Diff line Loading @@ -2021,15 +2021,19 @@ public class PackageWatchdog { bootMitigationCounts.put(observer.name, observer.getBootMitigationCount()); } FileOutputStream fileStream = null; ObjectOutputStream objectStream = null; try { FileOutputStream fileStream = new FileOutputStream(new File(filePath)); ObjectOutputStream objectStream = new ObjectOutputStream(fileStream); fileStream = new FileOutputStream(new File(filePath)); objectStream = new ObjectOutputStream(fileStream); objectStream.writeObject(bootMitigationCounts); objectStream.flush(); objectStream.close(); fileStream.close(); } catch (Exception e) { Slog.i(TAG, "Could not save observers metadata to file: " + e); return; } finally { IoUtils.closeQuietly(objectStream); IoUtils.closeQuietly(fileStream); } } Loading Loading @@ -2180,14 +2184,26 @@ public class PackageWatchdog { void readAllObserversBootMitigationCountIfNecessary(String filePath) { File metadataFile = new File(filePath); if (metadataFile.exists()) { FileInputStream fileStream = null; ObjectInputStream objectStream = null; HashMap<String, Integer> bootMitigationCounts = null; try { FileInputStream fileStream = new FileInputStream(metadataFile); ObjectInputStream objectStream = new ObjectInputStream(fileStream); HashMap<String, Integer> bootMitigationCounts = fileStream = new FileInputStream(metadataFile); objectStream = new ObjectInputStream(fileStream); bootMitigationCounts = (HashMap<String, Integer>) objectStream.readObject(); objectStream.close(); fileStream.close(); } catch (Exception e) { Slog.i(TAG, "Could not read observer metadata file: " + e); return; } finally { IoUtils.closeQuietly(objectStream); IoUtils.closeQuietly(fileStream); } if (bootMitigationCounts == null || bootMitigationCounts.isEmpty()) { Slog.i(TAG, "No observer in metadata file"); return; } for (int i = 0; i < mAllObservers.size(); i++) { final ObserverInternal observer = mAllObservers.valueAt(i); if (bootMitigationCounts.containsKey(observer.name)) { Loading @@ -2195,9 +2211,6 @@ public class PackageWatchdog { bootMitigationCounts.get(observer.name)); } } } catch (Exception e) { Slog.i(TAG, "Could not read observer metadata file: " + e); } } } } Loading