summaryrefslogtreecommitdiffstats
path: root/services/java
diff options
context:
space:
mode:
authorSteve Kondik <shade@chemlab.org>2013-06-27 00:07:34 -0700
committerSteve Kondik <shade@chemlab.org>2013-06-29 12:00:55 -0400
commitf9a18fc6e1745db990e4852df4453a8376fbf28f (patch)
tree2bc8b4c929fb9e9b65ca2eb1a7104330420ac9ae /services/java
parent9929e6bc78030aa92bfe14094ea3c3696818915a (diff)
downloadframeworks_base-f9a18fc6e1745db990e4852df4453a8376fbf28f.zip
frameworks_base-f9a18fc6e1745db990e4852df4453a8376fbf28f.tar.gz
frameworks_base-f9a18fc6e1745db990e4852df4453a8376fbf28f.tar.bz2
am: Fix the privacy guard notification
* The privacy guard notification was not showing everytime. Fix the logic and handle it in the right place so it hits both the create and resume startup path. Change-Id: I80c88ffb0fcb4ed3ea64ceb228bb436975278ecc
Diffstat (limited to 'services/java')
-rw-r--r--services/java/com/android/server/am/ActivityStack.java48
1 files changed, 24 insertions, 24 deletions
diff --git a/services/java/com/android/server/am/ActivityStack.java b/services/java/com/android/server/am/ActivityStack.java
index 4e9973f..6f6bf4d 100644
--- a/services/java/com/android/server/am/ActivityStack.java
+++ b/services/java/com/android/server/am/ActivityStack.java
@@ -283,6 +283,11 @@ final class ActivityStack {
*/
boolean mDismissKeyguardOnNextActivity = false;
+ /**
+ * Is the privacy guard currently enabled?
+ */
+ String mPrivacyGuardPackageName = null;
+
int mThumbnailWidth = -1;
int mThumbnailHeight = -1;
@@ -1249,6 +1254,7 @@ final class ActivityStack {
} else {
next.cpuTimeAtResume = 0; // Couldn't get the cpu time of process
}
+ updatePrivacyGuardNotificationLocked(next);
}
/**
@@ -1742,7 +1748,7 @@ final class ActivityStack {
next.app.pendingUiClean = true;
next.app.thread.scheduleResumeActivity(next.appToken,
mService.isNextTransitionForward());
-
+
checkReadyForSleepLocked();
} catch (Exception e) {
@@ -1803,40 +1809,34 @@ final class ActivityStack {
startSpecificActivityLocked(next, true, true);
}
- handlePrivacyGuardNotification(prev, next);
-
return true;
}
- private final void handlePrivacyGuardNotification(ActivityRecord prev, ActivityRecord next) {
- boolean curPrivacy = false;
- boolean prevPrivacy = false;
+ private final void updatePrivacyGuardNotificationLocked(ActivityRecord next) {
- if (next != null) {
- try {
- curPrivacy = AppGlobals.getPackageManager().getPrivacyGuardSetting(
- next.packageName, next.userId);
- } catch (RemoteException e) {
- // nothing
- }
+ if (mPrivacyGuardPackageName != null && mPrivacyGuardPackageName.equals(next.packageName)) {
+ return;
}
- if (prev != null) {
- try {
- prevPrivacy = AppGlobals.getPackageManager().getPrivacyGuardSetting(
- prev.packageName, prev.userId);
- } catch (RemoteException e) {
- // nothing
- }
+
+ boolean privacy = false;
+
+ try {
+ privacy = AppGlobals.getPackageManager().getPrivacyGuardSetting(
+ next.packageName, next.userId);
+ } catch (RemoteException e) {
+ // nothing
}
- if (prevPrivacy && !curPrivacy) {
+
+ if (mPrivacyGuardPackageName != null && !privacy) {
Message msg = mService.mHandler.obtainMessage(
- ActivityManagerService.CANCEL_PRIVACY_NOTIFICATION_MSG, prev.userId);
+ ActivityManagerService.CANCEL_PRIVACY_NOTIFICATION_MSG, next.userId);
msg.sendToTarget();
- } else if ((!prevPrivacy && curPrivacy) ||
- (prevPrivacy && curPrivacy && !next.packageName.equals(prev.packageName))) {
+ mPrivacyGuardPackageName = null;
+ } else if (privacy) {
Message msg = mService.mHandler.obtainMessage(
ActivityManagerService.POST_PRIVACY_NOTIFICATION_MSG, next);
msg.sendToTarget();
+ mPrivacyGuardPackageName = next.packageName;
}
}