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

Commit c327962b authored by Akash Garg's avatar Akash Garg Committed by Android (Google) Code Review
Browse files

Merge "fixing java.lang.NullPointerException issues when cache is not build" into main

parents 1c0cddb1 f4c981c5
Loading
Loading
Loading
Loading
+8 −7
Original line number Original line Diff line number Diff line
@@ -182,7 +182,7 @@ public class SatelliteOptimizedApplicationsTracker {
        List<UserInfo> users = mUserManager.getUsers();
        List<UserInfo> users = mUserManager.getUsers();
        for (UserInfo user : users) {
        for (UserInfo user : users) {
            int userId = user.getUserHandle().getIdentifier();
            int userId = user.getUserHandle().getIdentifier();
            mSatelliteApplications.put(userId, new HashSet<>());
            mSatelliteApplications.putIfAbsent(userId, new HashSet<>());
        }
        }
        // Get a list of installed packages
        // Get a list of installed packages
        List<PackageInfo> packages =
        List<PackageInfo> packages =
@@ -213,6 +213,7 @@ public class SatelliteOptimizedApplicationsTracker {
            try {
            try {
                mPackageManager.getPackageUidAsUser(
                mPackageManager.getPackageUidAsUser(
                        packageName, PackageManager.GET_META_DATA, userId);
                        packageName, PackageManager.GET_META_DATA, userId);
                mSatelliteApplications.putIfAbsent(userId, new HashSet<>());
                mSatelliteApplications.get(userId).add(packageName);
                mSatelliteApplications.get(userId).add(packageName);
            } catch (java.lang.Exception e) {
            } catch (java.lang.Exception e) {
                // package is not present for current user
                // package is not present for current user
@@ -229,7 +230,8 @@ public class SatelliteOptimizedApplicationsTracker {
                        packageName, PackageManager.GET_META_DATA, userId);
                        packageName, PackageManager.GET_META_DATA, userId);
            } catch (java.lang.Exception e) {
            } catch (java.lang.Exception e) {
                // package is not present for current user
                // 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);
                    mSatelliteApplications.get(userId).remove(packageName);
                }
                }
            }
            }
@@ -240,7 +242,6 @@ public class SatelliteOptimizedApplicationsTracker {
     * Get list of applications that are optimized for low bandwidth satellite data.
     * Get list of applications that are optimized for low bandwidth satellite data.
     *
     *
     * @param userId is Identifier of user
     * @param userId is Identifier of user
     *
     * @return List of applications package names with data optimized network property. {@link
     * @return List of applications package names with data optimized network property. {@link
     *     #PROPERTY_SATELLITE_DATA_OPTIMIZED}
     *     #PROPERTY_SATELLITE_DATA_OPTIMIZED}
     */
     */