Loading src/com/android/settings/notification/history/HistoryLoader.java +40 −35 Original line number Original line Diff line number Diff line Loading @@ -22,6 +22,7 @@ import android.content.Context; import android.content.pm.ApplicationInfo; import android.content.pm.ApplicationInfo; import android.content.pm.PackageManager; import android.content.pm.PackageManager; import android.os.UserHandle; import android.os.UserHandle; import android.util.Slog; import com.android.settings.notification.NotificationBackend; import com.android.settings.notification.NotificationBackend; import com.android.settingslib.utils.ThreadUtils; import com.android.settingslib.utils.ThreadUtils; Loading @@ -33,6 +34,7 @@ import java.util.List; import java.util.Map; import java.util.Map; public class HistoryLoader { public class HistoryLoader { private static final String TAG = "HistoryLoader"; private final Context mContext; private final Context mContext; private final NotificationBackend mBackend; private final NotificationBackend mBackend; private final PackageManager mPm; private final PackageManager mPm; Loading @@ -45,10 +47,10 @@ public class HistoryLoader { public void load(OnHistoryLoaderListener listener) { public void load(OnHistoryLoaderListener listener) { ThreadUtils.postOnBackgroundThread(() -> { ThreadUtils.postOnBackgroundThread(() -> { try { Map<String, NotificationHistoryPackage> historicalNotifications = new HashMap<>(); Map<String, NotificationHistoryPackage> historicalNotifications = new HashMap<>(); NotificationHistory history = NotificationHistory history = mBackend.getNotificationHistory(mContext.getPackageName()); mBackend.getNotificationHistory(mContext.getPackageName()); while (history.hasNextNotification()) { while (history.hasNextNotification()) { HistoricalNotification hn = history.getNextNotification(); HistoricalNotification hn = history.getNextNotification(); Loading Loading @@ -84,6 +86,9 @@ public class HistoryLoader { } } } } ThreadUtils.postOnMainThread(() -> listener.onHistoryLoaded(packages)); ThreadUtils.postOnMainThread(() -> listener.onHistoryLoaded(packages)); } catch (Exception e) { Slog.e(TAG, "Error loading history", e); } }); }); } } Loading Loading
src/com/android/settings/notification/history/HistoryLoader.java +40 −35 Original line number Original line Diff line number Diff line Loading @@ -22,6 +22,7 @@ import android.content.Context; import android.content.pm.ApplicationInfo; import android.content.pm.ApplicationInfo; import android.content.pm.PackageManager; import android.content.pm.PackageManager; import android.os.UserHandle; import android.os.UserHandle; import android.util.Slog; import com.android.settings.notification.NotificationBackend; import com.android.settings.notification.NotificationBackend; import com.android.settingslib.utils.ThreadUtils; import com.android.settingslib.utils.ThreadUtils; Loading @@ -33,6 +34,7 @@ import java.util.List; import java.util.Map; import java.util.Map; public class HistoryLoader { public class HistoryLoader { private static final String TAG = "HistoryLoader"; private final Context mContext; private final Context mContext; private final NotificationBackend mBackend; private final NotificationBackend mBackend; private final PackageManager mPm; private final PackageManager mPm; Loading @@ -45,10 +47,10 @@ public class HistoryLoader { public void load(OnHistoryLoaderListener listener) { public void load(OnHistoryLoaderListener listener) { ThreadUtils.postOnBackgroundThread(() -> { ThreadUtils.postOnBackgroundThread(() -> { try { Map<String, NotificationHistoryPackage> historicalNotifications = new HashMap<>(); Map<String, NotificationHistoryPackage> historicalNotifications = new HashMap<>(); NotificationHistory history = NotificationHistory history = mBackend.getNotificationHistory(mContext.getPackageName()); mBackend.getNotificationHistory(mContext.getPackageName()); while (history.hasNextNotification()) { while (history.hasNextNotification()) { HistoricalNotification hn = history.getNextNotification(); HistoricalNotification hn = history.getNextNotification(); Loading Loading @@ -84,6 +86,9 @@ public class HistoryLoader { } } } } ThreadUtils.postOnMainThread(() -> listener.onHistoryLoaded(packages)); ThreadUtils.postOnMainThread(() -> listener.onHistoryLoaded(packages)); } catch (Exception e) { Slog.e(TAG, "Error loading history", e); } }); }); } } Loading