Loading services/core/java/com/android/server/notification/NotificationHistoryDatabase.java +3 −1 Original line number Original line Diff line number Diff line Loading @@ -108,7 +108,9 @@ public class NotificationHistoryDatabase { public void init() { public void init() { synchronized (mLock) { synchronized (mLock) { try { try { mHistoryDir.mkdir(); if (!mHistoryDir.mkdir()) { throw new IllegalStateException("could not create history directory"); } mVersionFile.createNewFile(); mVersionFile.createNewFile(); } catch (Exception e) { } catch (Exception e) { Slog.e(TAG, "could not create needed files", e); Slog.e(TAG, "could not create needed files", e); Loading services/core/java/com/android/server/notification/NotificationHistoryManager.java +13 −9 Original line number Original line Diff line number Diff line Loading @@ -26,6 +26,7 @@ import android.content.Context; import android.content.pm.UserInfo; import android.content.pm.UserInfo; import android.database.ContentObserver; import android.database.ContentObserver; import android.net.Uri; import android.net.Uri; import android.os.Binder; import android.os.Environment; import android.os.Environment; import android.os.Handler; import android.os.Handler; import android.os.UserHandle; import android.os.UserHandle; Loading @@ -37,6 +38,7 @@ import android.util.SparseBooleanArray; import com.android.internal.annotations.GuardedBy; import com.android.internal.annotations.GuardedBy; import com.android.internal.annotations.VisibleForTesting; import com.android.internal.annotations.VisibleForTesting; import com.android.internal.util.FunctionalUtils; import com.android.server.IoThread; import com.android.server.IoThread; import java.io.File; import java.io.File; Loading Loading @@ -198,6 +200,7 @@ public class NotificationHistoryManager { } } public void addNotification(@NonNull final HistoricalNotification notification) { public void addNotification(@NonNull final HistoricalNotification notification) { Binder.withCleanCallingIdentity(() -> { synchronized (mLock) { synchronized (mLock) { final NotificationHistoryDatabase userHistory = final NotificationHistoryDatabase userHistory = getUserHistoryAndInitializeIfNeededLocked(notification.getUserId()); getUserHistoryAndInitializeIfNeededLocked(notification.getUserId()); Loading @@ -208,6 +211,7 @@ public class NotificationHistoryManager { } } userHistory.addNotification(notification); userHistory.addNotification(notification); } } }); } } public @NonNull NotificationHistory readNotificationHistory(@UserIdInt int[] userIds) { public @NonNull NotificationHistory readNotificationHistory(@UserIdInt int[] userIds) { Loading Loading
services/core/java/com/android/server/notification/NotificationHistoryDatabase.java +3 −1 Original line number Original line Diff line number Diff line Loading @@ -108,7 +108,9 @@ public class NotificationHistoryDatabase { public void init() { public void init() { synchronized (mLock) { synchronized (mLock) { try { try { mHistoryDir.mkdir(); if (!mHistoryDir.mkdir()) { throw new IllegalStateException("could not create history directory"); } mVersionFile.createNewFile(); mVersionFile.createNewFile(); } catch (Exception e) { } catch (Exception e) { Slog.e(TAG, "could not create needed files", e); Slog.e(TAG, "could not create needed files", e); Loading
services/core/java/com/android/server/notification/NotificationHistoryManager.java +13 −9 Original line number Original line Diff line number Diff line Loading @@ -26,6 +26,7 @@ import android.content.Context; import android.content.pm.UserInfo; import android.content.pm.UserInfo; import android.database.ContentObserver; import android.database.ContentObserver; import android.net.Uri; import android.net.Uri; import android.os.Binder; import android.os.Environment; import android.os.Environment; import android.os.Handler; import android.os.Handler; import android.os.UserHandle; import android.os.UserHandle; Loading @@ -37,6 +38,7 @@ import android.util.SparseBooleanArray; import com.android.internal.annotations.GuardedBy; import com.android.internal.annotations.GuardedBy; import com.android.internal.annotations.VisibleForTesting; import com.android.internal.annotations.VisibleForTesting; import com.android.internal.util.FunctionalUtils; import com.android.server.IoThread; import com.android.server.IoThread; import java.io.File; import java.io.File; Loading Loading @@ -198,6 +200,7 @@ public class NotificationHistoryManager { } } public void addNotification(@NonNull final HistoricalNotification notification) { public void addNotification(@NonNull final HistoricalNotification notification) { Binder.withCleanCallingIdentity(() -> { synchronized (mLock) { synchronized (mLock) { final NotificationHistoryDatabase userHistory = final NotificationHistoryDatabase userHistory = getUserHistoryAndInitializeIfNeededLocked(notification.getUserId()); getUserHistoryAndInitializeIfNeededLocked(notification.getUserId()); Loading @@ -208,6 +211,7 @@ public class NotificationHistoryManager { } } userHistory.addNotification(notification); userHistory.addNotification(notification); } } }); } } public @NonNull NotificationHistory readNotificationHistory(@UserIdInt int[] userIds) { public @NonNull NotificationHistory readNotificationHistory(@UserIdInt int[] userIds) { Loading