Loading packages/CarSystemUI/src/com/android/systemui/statusbar/car/privacy/OngoingPrivacyChip.java +9 −12 Original line number Diff line number Diff line Loading @@ -47,6 +47,7 @@ import java.util.stream.Collectors; public class OngoingPrivacyChip extends LinearLayout implements View.OnClickListener { private Context mContext; private Handler mHandler; private LinearLayout mIconsContainer; private List<PrivacyItem> mPrivacyItems; Loading Loading @@ -88,6 +89,7 @@ public class OngoingPrivacyChip extends LinearLayout implements View.OnClickList private void init(Context context) { mContext = context; mHandler = new Handler(Looper.getMainLooper()); mPrivacyItems = new ArrayList<>(); sAppOpsController = Dependency.get(AppOpsController.class); mUserManager = mContext.getSystemService(UserManager.class); Loading Loading @@ -131,8 +133,7 @@ public class OngoingPrivacyChip extends LinearLayout implements View.OnClickList @Override public void onClick(View v) { updatePrivacyList(); Handler mUiHandler = new Handler(Looper.getMainLooper()); mUiHandler.post(() -> { mHandler.post(() -> { mActivityStarter.postStartActivityDismissingKeyguard( new Intent(Intent.ACTION_REVIEW_ONGOING_PERMISSION_USAGE), 0); }); Loading @@ -152,21 +153,17 @@ public class OngoingPrivacyChip extends LinearLayout implements View.OnClickList } private void updatePrivacyList() { mPrivacyItems = mCurrentUserIds.stream() List<PrivacyItem> privacyItems = mCurrentUserIds.stream() .flatMap(item -> sAppOpsController.getActiveAppOpsForUser(item).stream()) .filter(Objects::nonNull) .map(item -> toPrivacyItem(item)) .filter(Objects::nonNull) .collect(Collectors.toList()); if (!privacyItems.equals(mPrivacyItems)) { mPrivacyItems = privacyItems; mPrivacyDialogBuilder = new PrivacyDialogBuilder(mContext, mPrivacyItems); Handler refresh = new Handler(Looper.getMainLooper()); refresh.post(new Runnable() { @Override public void run() { updateView(); mHandler.post(this::updateView); } }); } private PrivacyItem toPrivacyItem(AppOpItem appOpItem) { Loading packages/CarSystemUI/src/com/android/systemui/statusbar/car/privacy/PrivacyApplication.java +17 −0 Original line number Diff line number Diff line Loading @@ -23,16 +23,20 @@ import android.content.pm.PackageManager; import android.graphics.drawable.Drawable; import android.util.Log; import java.util.Objects; /** * Class to hold the data for the applications that are using the AppOps permissions. */ public class PrivacyApplication { private static final String TAG = "PrivacyApplication"; private String mPackageName; private Drawable mIcon; private String mApplicationName; public PrivacyApplication(String packageName, Context context) { mPackageName = packageName; try { CarUserManagerHelper carUserManagerHelper = new CarUserManagerHelper(context); ApplicationInfo app = context.getPackageManager() Loading @@ -59,4 +63,17 @@ public class PrivacyApplication { public String getApplicationName() { return mApplicationName; } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; PrivacyApplication that = (PrivacyApplication) o; return mPackageName.equals(that.mPackageName); } @Override public int hashCode() { return Objects.hash(mPackageName); } } packages/CarSystemUI/src/com/android/systemui/statusbar/car/privacy/PrivacyItem.java +16 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ package com.android.systemui.statusbar.car.privacy; import java.util.Objects; /** * Class for holding the data of each privacy item displayed in {@link OngoingPrivacyDialog} */ Loading Loading @@ -43,4 +45,18 @@ public class PrivacyItem { public PrivacyType getPrivacyType() { return mPrivacyType; } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; PrivacyItem that = (PrivacyItem) o; return mPrivacyType == that.mPrivacyType && mPrivacyApplication.equals(that.mPrivacyApplication); } @Override public int hashCode() { return Objects.hash(mPrivacyType, mPrivacyApplication); } } Loading
packages/CarSystemUI/src/com/android/systemui/statusbar/car/privacy/OngoingPrivacyChip.java +9 −12 Original line number Diff line number Diff line Loading @@ -47,6 +47,7 @@ import java.util.stream.Collectors; public class OngoingPrivacyChip extends LinearLayout implements View.OnClickListener { private Context mContext; private Handler mHandler; private LinearLayout mIconsContainer; private List<PrivacyItem> mPrivacyItems; Loading Loading @@ -88,6 +89,7 @@ public class OngoingPrivacyChip extends LinearLayout implements View.OnClickList private void init(Context context) { mContext = context; mHandler = new Handler(Looper.getMainLooper()); mPrivacyItems = new ArrayList<>(); sAppOpsController = Dependency.get(AppOpsController.class); mUserManager = mContext.getSystemService(UserManager.class); Loading Loading @@ -131,8 +133,7 @@ public class OngoingPrivacyChip extends LinearLayout implements View.OnClickList @Override public void onClick(View v) { updatePrivacyList(); Handler mUiHandler = new Handler(Looper.getMainLooper()); mUiHandler.post(() -> { mHandler.post(() -> { mActivityStarter.postStartActivityDismissingKeyguard( new Intent(Intent.ACTION_REVIEW_ONGOING_PERMISSION_USAGE), 0); }); Loading @@ -152,21 +153,17 @@ public class OngoingPrivacyChip extends LinearLayout implements View.OnClickList } private void updatePrivacyList() { mPrivacyItems = mCurrentUserIds.stream() List<PrivacyItem> privacyItems = mCurrentUserIds.stream() .flatMap(item -> sAppOpsController.getActiveAppOpsForUser(item).stream()) .filter(Objects::nonNull) .map(item -> toPrivacyItem(item)) .filter(Objects::nonNull) .collect(Collectors.toList()); if (!privacyItems.equals(mPrivacyItems)) { mPrivacyItems = privacyItems; mPrivacyDialogBuilder = new PrivacyDialogBuilder(mContext, mPrivacyItems); Handler refresh = new Handler(Looper.getMainLooper()); refresh.post(new Runnable() { @Override public void run() { updateView(); mHandler.post(this::updateView); } }); } private PrivacyItem toPrivacyItem(AppOpItem appOpItem) { Loading
packages/CarSystemUI/src/com/android/systemui/statusbar/car/privacy/PrivacyApplication.java +17 −0 Original line number Diff line number Diff line Loading @@ -23,16 +23,20 @@ import android.content.pm.PackageManager; import android.graphics.drawable.Drawable; import android.util.Log; import java.util.Objects; /** * Class to hold the data for the applications that are using the AppOps permissions. */ public class PrivacyApplication { private static final String TAG = "PrivacyApplication"; private String mPackageName; private Drawable mIcon; private String mApplicationName; public PrivacyApplication(String packageName, Context context) { mPackageName = packageName; try { CarUserManagerHelper carUserManagerHelper = new CarUserManagerHelper(context); ApplicationInfo app = context.getPackageManager() Loading @@ -59,4 +63,17 @@ public class PrivacyApplication { public String getApplicationName() { return mApplicationName; } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; PrivacyApplication that = (PrivacyApplication) o; return mPackageName.equals(that.mPackageName); } @Override public int hashCode() { return Objects.hash(mPackageName); } }
packages/CarSystemUI/src/com/android/systemui/statusbar/car/privacy/PrivacyItem.java +16 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ package com.android.systemui.statusbar.car.privacy; import java.util.Objects; /** * Class for holding the data of each privacy item displayed in {@link OngoingPrivacyDialog} */ Loading Loading @@ -43,4 +45,18 @@ public class PrivacyItem { public PrivacyType getPrivacyType() { return mPrivacyType; } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; PrivacyItem that = (PrivacyItem) o; return mPrivacyType == that.mPrivacyType && mPrivacyApplication.equals(that.mPrivacyApplication); } @Override public int hashCode() { return Objects.hash(mPrivacyType, mPrivacyApplication); } }