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

Commit f4c981c5 authored by Akash Garg's avatar Akash Garg
Browse files

fixing java.lang.NullPointerException issues when cache is not build

Bug: 396573819
Flag: EXEMPT bug fix
Test: CTS verified
Change-Id: I0d5f23f293476e4e7e9e899556753569ca5e3282
parent d59b5d8e
Loading
Loading
Loading
Loading
+8 −7
Original line number Diff line number Diff line
@@ -182,7 +182,7 @@ public class SatelliteOptimizedApplicationsTracker {
        List<UserInfo> users = mUserManager.getUsers();
        for (UserInfo user : users) {
            int userId = user.getUserHandle().getIdentifier();
            mSatelliteApplications.put(userId, new HashSet<>());
            mSatelliteApplications.putIfAbsent(userId, new HashSet<>());
        }
        // Get a list of installed packages
        List<PackageInfo> packages =
@@ -213,6 +213,7 @@ public class SatelliteOptimizedApplicationsTracker {
            try {
                mPackageManager.getPackageUidAsUser(
                        packageName, PackageManager.GET_META_DATA, userId);
                mSatelliteApplications.putIfAbsent(userId, new HashSet<>());
                mSatelliteApplications.get(userId).add(packageName);
            } catch (java.lang.Exception e) {
                // package is not present for current user
@@ -229,7 +230,8 @@ public class SatelliteOptimizedApplicationsTracker {
                        packageName, PackageManager.GET_META_DATA, userId);
            } catch (java.lang.Exception e) {
                // package is not present for current user
                if (mSatelliteApplications.get(userId).contains(packageName)) {
                if (mSatelliteApplications.containsKey(userId)
                        && mSatelliteApplications.get(userId).contains(packageName)) {
                    mSatelliteApplications.get(userId).remove(packageName);
                }
            }
@@ -240,7 +242,6 @@ public class SatelliteOptimizedApplicationsTracker {
     * Get list of applications that are optimized for low bandwidth satellite data.
     *
     * @param userId is Identifier of user
     *
     * @return List of applications package names with data optimized network property. {@link
     *     #PROPERTY_SATELLITE_DATA_OPTIMIZED}
     */