diff options
author | Ram Periathiruvadi | 2018-07-11 22:22:36 -0500 |
---|---|---|
committer | Android (Google) Code Review | 2018-07-11 22:22:36 -0500 |
commit | 94b37d8d1055518f987b2d7097cbbe12de212808 (patch) | |
tree | 2ce4e5c8237e68bec62363c2203ccaebd77d68de /service | |
parent | 44d57dcc48310e4a3e697e16fc89238ee78370ce (diff) | |
parent | 402d12eca4c8a9b085c196aea7dc31d5cc0abb4e (diff) | |
download | platform-packages-services-car-94b37d8d1055518f987b2d7097cbbe12de212808.tar.gz platform-packages-services-car-94b37d8d1055518f987b2d7097cbbe12de212808.tar.xz platform-packages-services-car-94b37d8d1055518f987b2d7097cbbe12de212808.zip |
Merge "Fix CarPackageManager reading blacklisted packages." into pi-dev
Diffstat (limited to 'service')
-rw-r--r-- | service/src/com/android/car/pm/CarPackageManagerService.java | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/service/src/com/android/car/pm/CarPackageManagerService.java b/service/src/com/android/car/pm/CarPackageManagerService.java index 3f3f0516..19806661 100644 --- a/service/src/com/android/car/pm/CarPackageManagerService.java +++ b/service/src/com/android/car/pm/CarPackageManagerService.java | |||
@@ -46,6 +46,7 @@ import android.os.HandlerThread; | |||
46 | import android.os.Looper; | 46 | import android.os.Looper; |
47 | import android.os.Message; | 47 | import android.os.Message; |
48 | import android.os.Process; | 48 | import android.os.Process; |
49 | import android.text.TextUtils; | ||
49 | import android.text.format.DateFormat; | 50 | import android.text.format.DateFormat; |
50 | import android.util.ArraySet; | 51 | import android.util.ArraySet; |
51 | import android.util.Log; | 52 | import android.util.Log; |
@@ -541,8 +542,10 @@ public class CarPackageManagerService extends ICarPackageManager.Stub implements | |||
541 | // Add the blocking overlay activity to the whitelist, since that needs to run in a | 542 | // Add the blocking overlay activity to the whitelist, since that needs to run in a |
542 | // restricted state to communicate the reason an app was blocked. | 543 | // restricted state to communicate the reason an app was blocked. |
543 | Set<String> defaultActivity = new ArraySet<>(); | 544 | Set<String> defaultActivity = new ArraySet<>(); |
544 | defaultActivity.add(mActivityBlockingActivity.getClassName()); | 545 | if (mActivityBlockingActivity != null) { |
545 | configWhitelist.put(mActivityBlockingActivity.getPackageName(), defaultActivity); | 546 | defaultActivity.add(mActivityBlockingActivity.getClassName()); |
547 | configWhitelist.put(mActivityBlockingActivity.getPackageName(), defaultActivity); | ||
548 | } | ||
546 | 549 | ||
547 | List<PackageInfo> packages = mPackageManager.getInstalledPackages( | 550 | List<PackageInfo> packages = mPackageManager.getInstalledPackages( |
548 | PackageManager.GET_SIGNATURES | PackageManager.GET_ACTIVITIES | 551 | PackageManager.GET_SIGNATURES | PackageManager.GET_ACTIVITIES |
@@ -678,6 +681,11 @@ public class CarPackageManagerService extends ICarPackageManager.Stub implements | |||
678 | } | 681 | } |
679 | 682 | ||
680 | for (String pkg : configBlacklist.keySet()) { | 683 | for (String pkg : configBlacklist.keySet()) { |
684 | if (TextUtils.isEmpty(pkg)) { | ||
685 | // This means there is nothing to blacklist | ||
686 | Log.d(CarLog.TAG_PACKAGE, "Empty string in blacklist pkg"); | ||
687 | continue; | ||
688 | } | ||
681 | int flags = 0; | 689 | int flags = 0; |
682 | PackageInfo pkgInfo; | 690 | PackageInfo pkgInfo; |
683 | String[] activities; | 691 | String[] activities; |
@@ -688,7 +696,7 @@ public class CarPackageManagerService extends ICarPackageManager.Stub implements | |||
688 | | PackageManager.MATCH_DIRECT_BOOT_AWARE | 696 | | PackageManager.MATCH_DIRECT_BOOT_AWARE |
689 | | PackageManager.MATCH_DIRECT_BOOT_UNAWARE); | 697 | | PackageManager.MATCH_DIRECT_BOOT_UNAWARE); |
690 | } catch (NameNotFoundException e) { | 698 | } catch (NameNotFoundException e) { |
691 | Log.e(CarLog.TAG_PACKAGE, pkg + " not found to blacklist " + e); | 699 | Log.e(CarLog.TAG_PACKAGE, pkg + " not found to blacklist ", e); |
692 | continue; | 700 | continue; |
693 | } | 701 | } |
694 | 702 | ||