summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--core/java/android/app/ActivityManager.java29
-rw-r--r--core/java/com/android/internal/app/ProcessStats.java1
-rw-r--r--services/core/java/com/android/server/am/ActivityManagerService.java46
-rw-r--r--services/core/java/com/android/server/am/ProcessList.java10
-rw-r--r--services/core/java/com/android/server/am/ProcessRecord.java11
-rw-r--r--services/core/java/com/android/server/pm/PackageManagerService.java133
6 files changed, 143 insertions, 87 deletions
diff --git a/core/java/android/app/ActivityManager.java b/core/java/android/app/ActivityManager.java
index 3892dd9..da345a6 100644
--- a/core/java/android/app/ActivityManager.java
+++ b/core/java/android/app/ActivityManager.java
@@ -279,51 +279,54 @@ public class ActivityManager {
* all activities that are visible to the user. */
public static final int PROCESS_STATE_TOP = 2;
+ /** @hide Process is hosting a foreground service due to a system binding. */
+ public static final int PROCESS_STATE_BOUND_FOREGROUND_SERVICE = 3;
+
/** @hide Process is hosting a foreground service. */
- public static final int PROCESS_STATE_FOREGROUND_SERVICE = 3;
+ public static final int PROCESS_STATE_FOREGROUND_SERVICE = 4;
/** @hide Same as {@link #PROCESS_STATE_TOP} but while device is sleeping. */
- public static final int PROCESS_STATE_TOP_SLEEPING = 4;
+ public static final int PROCESS_STATE_TOP_SLEEPING = 5;
/** @hide Process is important to the user, and something they are aware of. */
- public static final int PROCESS_STATE_IMPORTANT_FOREGROUND = 5;
+ public static final int PROCESS_STATE_IMPORTANT_FOREGROUND = 6;
/** @hide Process is important to the user, but not something they are aware of. */
- public static final int PROCESS_STATE_IMPORTANT_BACKGROUND = 6;
+ public static final int PROCESS_STATE_IMPORTANT_BACKGROUND = 7;
/** @hide Process is in the background running a backup/restore operation. */
- public static final int PROCESS_STATE_BACKUP = 7;
+ public static final int PROCESS_STATE_BACKUP = 8;
/** @hide Process is in the background, but it can't restore its state so we want
* to try to avoid killing it. */
- public static final int PROCESS_STATE_HEAVY_WEIGHT = 8;
+ public static final int PROCESS_STATE_HEAVY_WEIGHT = 9;
/** @hide Process is in the background running a service. Unlike oom_adj, this level
* is used for both the normal running in background state and the executing
* operations state. */
- public static final int PROCESS_STATE_SERVICE = 9;
+ public static final int PROCESS_STATE_SERVICE = 10;
/** @hide Process is in the background running a receiver. Note that from the
* perspective of oom_adj receivers run at a higher foreground level, but for our
* prioritization here that is not necessary and putting them below services means
* many fewer changes in some process states as they receive broadcasts. */
- public static final int PROCESS_STATE_RECEIVER = 10;
+ public static final int PROCESS_STATE_RECEIVER = 11;
/** @hide Process is in the background but hosts the home activity. */
- public static final int PROCESS_STATE_HOME = 11;
+ public static final int PROCESS_STATE_HOME = 12;
/** @hide Process is in the background but hosts the last shown activity. */
- public static final int PROCESS_STATE_LAST_ACTIVITY = 12;
+ public static final int PROCESS_STATE_LAST_ACTIVITY = 13;
/** @hide Process is being cached for later use and contains activities. */
- public static final int PROCESS_STATE_CACHED_ACTIVITY = 13;
+ public static final int PROCESS_STATE_CACHED_ACTIVITY = 14;
/** @hide Process is being cached for later use and is a client of another cached
* process that contains activities. */
- public static final int PROCESS_STATE_CACHED_ACTIVITY_CLIENT = 14;
+ public static final int PROCESS_STATE_CACHED_ACTIVITY_CLIENT = 15;
/** @hide Process is being cached for later use and is empty. */
- public static final int PROCESS_STATE_CACHED_EMPTY = 15;
+ public static final int PROCESS_STATE_CACHED_EMPTY = 16;
/** @hide requestType for assist context: only basic information. */
public static final int ASSIST_CONTEXT_BASIC = 0;
diff --git a/core/java/com/android/internal/app/ProcessStats.java b/core/java/com/android/internal/app/ProcessStats.java
index fe79eff..27aec4e 100644
--- a/core/java/com/android/internal/app/ProcessStats.java
+++ b/core/java/com/android/internal/app/ProcessStats.java
@@ -140,6 +140,7 @@ public final class ProcessStats implements Parcelable {
STATE_PERSISTENT, // ActivityManager.PROCESS_STATE_PERSISTENT
STATE_PERSISTENT, // ActivityManager.PROCESS_STATE_PERSISTENT_UI
STATE_TOP, // ActivityManager.PROCESS_STATE_TOP
+ STATE_IMPORTANT_FOREGROUND, // ActivityManager.PROCESS_STATE_BOUND_FOREGROUND_SERVICE
STATE_IMPORTANT_FOREGROUND, // ActivityManager.PROCESS_STATE_FOREGROUND_SERVICE
STATE_TOP, // ActivityManager.PROCESS_STATE_TOP_SLEEPING
STATE_IMPORTANT_FOREGROUND, // ActivityManager.PROCESS_STATE_IMPORTANT_FOREGROUND
diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java
index bedc729..5fedbe4 100644
--- a/services/core/java/com/android/server/am/ActivityManagerService.java
+++ b/services/core/java/com/android/server/am/ActivityManagerService.java
@@ -355,6 +355,10 @@ public final class ActivityManagerService extends ActivityManagerNative
// giving up on them and unfreezing the screen.
static final int USER_SWITCH_TIMEOUT = 2*1000;
+ // This is the amount of time an app needs to be running a foreground service before
+ // we will consider it to be doing interaction for usage stats.
+ static final int SERVICE_USAGE_INTERACTION_TIME = 30*60*1000;
+
// Maximum number of users we allow to be running at a time.
static final int MAX_RUNNING_USERS = 3;
@@ -17752,13 +17756,13 @@ public final class ActivityManagerService extends ActivityManagerNative
// give them the best state after that.
if ((cr.flags&Context.BIND_FOREGROUND_SERVICE) != 0) {
clientProcState =
- ActivityManager.PROCESS_STATE_FOREGROUND_SERVICE;
+ ActivityManager.PROCESS_STATE_BOUND_FOREGROUND_SERVICE;
} else if (mWakefulness
== PowerManagerInternal.WAKEFULNESS_AWAKE &&
(cr.flags&Context.BIND_FOREGROUND_SERVICE_WHILE_AWAKE)
!= 0) {
clientProcState =
- ActivityManager.PROCESS_STATE_FOREGROUND_SERVICE;
+ ActivityManager.PROCESS_STATE_BOUND_FOREGROUND_SERVICE;
} else {
clientProcState =
ActivityManager.PROCESS_STATE_IMPORTANT_FOREGROUND;
@@ -17872,7 +17876,7 @@ public final class ActivityManagerService extends ActivityManagerNative
// into the top state, since they are not on top. Instead
// give them the best state after that.
clientProcState =
- ActivityManager.PROCESS_STATE_FOREGROUND_SERVICE;
+ ActivityManager.PROCESS_STATE_BOUND_FOREGROUND_SERVICE;
}
}
if (procState > clientProcState) {
@@ -17912,7 +17916,7 @@ public final class ActivityManagerService extends ActivityManagerNative
case ActivityManager.PROCESS_STATE_SERVICE:
// These all are longer-term states, so pull them up to the top
// of the background states, but not all the way to the top state.
- procState = ActivityManager.PROCESS_STATE_FOREGROUND_SERVICE;
+ procState = ActivityManager.PROCESS_STATE_BOUND_FOREGROUND_SERVICE;
break;
default:
// Otherwise, top is a better choice, so take it.
@@ -18482,7 +18486,7 @@ public final class ActivityManagerService extends ActivityManagerNative
}
// Inform UsageStats of important process state change
// Must be called before updating setProcState
- maybeUpdateUsageStats(app);
+ maybeUpdateUsageStatsLocked(app);
app.setProcState = app.curProcState;
if (app.setProcState >= ActivityManager.PROCESS_STATE_HOME) {
@@ -18571,7 +18575,7 @@ public final class ActivityManagerService extends ActivityManagerNative
uidRec.pendingChange.processState = uidRec.setProcState;
}
- private void maybeUpdateUsageStats(ProcessRecord app) {
+ private void maybeUpdateUsageStatsLocked(ProcessRecord app) {
if (DEBUG_USAGE_STATS) {
Slog.d(TAG, "Checking proc [" + Arrays.toString(app.getPackageList())
+ "] state changes: old = " + app.setProcState + ", new = "
@@ -18580,9 +18584,32 @@ public final class ActivityManagerService extends ActivityManagerNative
if (mUsageStatsService == null) {
return;
}
- if (app.curProcState <= ActivityManager.PROCESS_STATE_IMPORTANT_FOREGROUND
- && (app.setProcState > ActivityManager.PROCESS_STATE_IMPORTANT_FOREGROUND
- || app.setProcState < 0)) {
+ boolean isInteraction;
+ if (!mSleeping) {
+ isInteraction = app.curProcState <= ActivityManager.PROCESS_STATE_IMPORTANT_FOREGROUND;
+ app.fgInteractionTime = 0;
+ } else {
+ // If the display is off, we are going to be more restrictive about what we consider
+ // to be an app interaction. Being the top activity doesn't count, nor do generally
+ // foreground services.
+ if (app.curProcState <= ActivityManager.PROCESS_STATE_BOUND_FOREGROUND_SERVICE) {
+ isInteraction = true;
+ app.fgInteractionTime = 0;
+ } else if (app.curProcState <= ActivityManager.PROCESS_STATE_TOP_SLEEPING) {
+ final long now = SystemClock.elapsedRealtime();
+ if (app.fgInteractionTime == 0) {
+ app.fgInteractionTime = now;
+ isInteraction = false;
+ } else {
+ isInteraction = now > app.fgInteractionTime + SERVICE_USAGE_INTERACTION_TIME;
+ }
+ } else {
+ isInteraction = app.curProcState
+ <= ActivityManager.PROCESS_STATE_IMPORTANT_FOREGROUND;
+ app.fgInteractionTime = 0;
+ }
+ }
+ if (isInteraction && !app.reportedInteraction) {
String[] packages = app.getPackageList();
if (packages != null) {
for (int i = 0; i < packages.length; i++) {
@@ -18591,6 +18618,7 @@ public final class ActivityManagerService extends ActivityManagerNative
}
}
}
+ app.reportedInteraction = isInteraction;
}
private final void setProcessTrackerStateLocked(ProcessRecord proc, int memFactor, long now) {
diff --git a/services/core/java/com/android/server/am/ProcessList.java b/services/core/java/com/android/server/am/ProcessList.java
index cdfcd0c..0e24952 100644
--- a/services/core/java/com/android/server/am/ProcessList.java
+++ b/services/core/java/com/android/server/am/ProcessList.java
@@ -368,8 +368,11 @@ final class ProcessList {
case ActivityManager.PROCESS_STATE_TOP:
procState = "T ";
break;
+ case ActivityManager.PROCESS_STATE_BOUND_FOREGROUND_SERVICE:
+ procState = "SB";
+ break;
case ActivityManager.PROCESS_STATE_FOREGROUND_SERVICE:
- procState = "FS";
+ procState = "SF";
break;
case ActivityManager.PROCESS_STATE_TOP_SLEEPING:
procState = "TS";
@@ -481,6 +484,7 @@ final class ProcessList {
PROC_MEM_PERSISTENT, // ActivityManager.PROCESS_STATE_PERSISTENT
PROC_MEM_PERSISTENT, // ActivityManager.PROCESS_STATE_PERSISTENT_UI
PROC_MEM_TOP, // ActivityManager.PROCESS_STATE_TOP
+ PROC_MEM_IMPORTANT, // ActivityManager.PROCESS_STATE_BOUND_FOREGROUND_SERVICE
PROC_MEM_IMPORTANT, // ActivityManager.PROCESS_STATE_FOREGROUND_SERVICE
PROC_MEM_TOP, // ActivityManager.PROCESS_STATE_TOP_SLEEPING
PROC_MEM_IMPORTANT, // ActivityManager.PROCESS_STATE_IMPORTANT_FOREGROUND
@@ -500,6 +504,7 @@ final class ProcessList {
PSS_SHORT_INTERVAL, // ActivityManager.PROCESS_STATE_PERSISTENT
PSS_SHORT_INTERVAL, // ActivityManager.PROCESS_STATE_PERSISTENT_UI
PSS_FIRST_TOP_INTERVAL, // ActivityManager.PROCESS_STATE_TOP
+ PSS_FIRST_BACKGROUND_INTERVAL, // ActivityManager.PROCESS_STATE_BOUND_FOREGROUND_SERVICE
PSS_FIRST_BACKGROUND_INTERVAL, // ActivityManager.PROCESS_STATE_FOREGROUND_SERVICE
PSS_FIRST_BACKGROUND_INTERVAL, // ActivityManager.PROCESS_STATE_TOP_SLEEPING
PSS_FIRST_BACKGROUND_INTERVAL, // ActivityManager.PROCESS_STATE_IMPORTANT_FOREGROUND
@@ -519,6 +524,7 @@ final class ProcessList {
PSS_SAME_IMPORTANT_INTERVAL, // ActivityManager.PROCESS_STATE_PERSISTENT
PSS_SAME_IMPORTANT_INTERVAL, // ActivityManager.PROCESS_STATE_PERSISTENT_UI
PSS_SHORT_INTERVAL, // ActivityManager.PROCESS_STATE_TOP
+ PSS_SAME_IMPORTANT_INTERVAL, // ActivityManager.PROCESS_STATE_BOUND_FOREGROUND_SERVICE
PSS_SAME_IMPORTANT_INTERVAL, // ActivityManager.PROCESS_STATE_FOREGROUND_SERVICE
PSS_SAME_IMPORTANT_INTERVAL, // ActivityManager.PROCESS_STATE_TOP_SLEEPING
PSS_SAME_IMPORTANT_INTERVAL, // ActivityManager.PROCESS_STATE_IMPORTANT_FOREGROUND
@@ -538,6 +544,7 @@ final class ProcessList {
PSS_TEST_FIRST_TOP_INTERVAL, // ActivityManager.PROCESS_STATE_PERSISTENT
PSS_TEST_FIRST_TOP_INTERVAL, // ActivityManager.PROCESS_STATE_PERSISTENT_UI
PSS_TEST_FIRST_TOP_INTERVAL, // ActivityManager.PROCESS_STATE_TOP
+ PSS_FIRST_BACKGROUND_INTERVAL, // ActivityManager.PROCESS_STATE_BOUND_FOREGROUND_SERVICE
PSS_FIRST_BACKGROUND_INTERVAL, // ActivityManager.PROCESS_STATE_FOREGROUND_SERVICE
PSS_FIRST_BACKGROUND_INTERVAL, // ActivityManager.PROCESS_STATE_TOP_SLEEPING
PSS_TEST_FIRST_BACKGROUND_INTERVAL, // ActivityManager.PROCESS_STATE_IMPORTANT_FOREGROUND
@@ -557,6 +564,7 @@ final class ProcessList {
PSS_TEST_SAME_BACKGROUND_INTERVAL, // ActivityManager.PROCESS_STATE_PERSISTENT
PSS_TEST_SAME_BACKGROUND_INTERVAL, // ActivityManager.PROCESS_STATE_PERSISTENT_UI
PSS_TEST_SAME_IMPORTANT_INTERVAL, // ActivityManager.PROCESS_STATE_TOP
+ PSS_TEST_SAME_IMPORTANT_INTERVAL, // ActivityManager.PROCESS_STATE_BOUND_FOREGROUND_SERVICE
PSS_TEST_SAME_IMPORTANT_INTERVAL, // ActivityManager.PROCESS_STATE_FOREGROUND_SERVICE
PSS_TEST_SAME_IMPORTANT_INTERVAL, // ActivityManager.PROCESS_STATE_TOP_SLEEPING
PSS_TEST_SAME_IMPORTANT_INTERVAL, // ActivityManager.PROCESS_STATE_IMPORTANT_FOREGROUND
diff --git a/services/core/java/com/android/server/am/ProcessRecord.java b/services/core/java/com/android/server/am/ProcessRecord.java
index 14759c3..3acd3a3 100644
--- a/services/core/java/com/android/server/am/ProcessRecord.java
+++ b/services/core/java/com/android/server/am/ProcessRecord.java
@@ -112,6 +112,8 @@ final class ProcessRecord {
boolean killedByAm; // True when proc has been killed by activity manager, not for RAM
boolean killed; // True once we know the process has been killed
boolean procStateChanged; // Keep track of whether we changed 'setAdj'.
+ boolean reportedInteraction;// Whether we have told usage stats about it being an interaction
+ long fgInteractionTime; // When we became foreground for interaction purposes
String waitingToKill; // Process is waiting to be killed when in the bg, and reason
IBinder forcingToForeground;// Token that is forcing this process to be foreground
int adjSeq; // Sequence id for identifying oom_adj assignment cycles
@@ -291,6 +293,15 @@ final class ProcessRecord {
pw.print(" foregroundServices="); pw.print(foregroundServices);
pw.print(" forcingToForeground="); pw.println(forcingToForeground);
}
+ if (reportedInteraction || fgInteractionTime != 0) {
+ pw.print(prefix); pw.print("reportedInteraction=");
+ pw.print(reportedInteraction);
+ if (fgInteractionTime != 0) {
+ pw.print(" fgInteractionTime=");
+ TimeUtils.formatDuration(fgInteractionTime, SystemClock.elapsedRealtime(), pw);
+ }
+ pw.println();
+ }
if (persistent || removed) {
pw.print(prefix); pw.print("persistent="); pw.print(persistent);
pw.print(" removed="); pw.println(removed);
diff --git a/services/core/java/com/android/server/pm/PackageManagerService.java b/services/core/java/com/android/server/pm/PackageManagerService.java
index 604ac97..e2cc3f7 100644
--- a/services/core/java/com/android/server/pm/PackageManagerService.java
+++ b/services/core/java/com/android/server/pm/PackageManagerService.java
@@ -278,6 +278,7 @@ public class PackageManagerService extends IPackageManager.Stub {
private static final boolean DEBUG_VERIFY = false;
private static final boolean DEBUG_DEXOPT = false;
private static final boolean DEBUG_ABI_SELECTION = false;
+ private static final boolean DEBUG_DOMAIN_VERIFICATION = false;
private static final int RADIO_UID = Process.PHONE_UID;
private static final int LOG_UID = Process.LOG_UID;
@@ -620,7 +621,8 @@ public class PackageManagerService extends IPackageManager.Stub {
UserHandle user = new UserHandle(userId);
mContext.sendBroadcastAsUser(verificationIntent, user);
- Slog.d(TAG, "Sending IntenFilter verification broadcast");
+ if (DEBUG_DOMAIN_VERIFICATION) Slog.d(TAG,
+ "Sending IntenFilter verification broadcast");
}
public void receiveVerificationResponse(int verificationId) {
@@ -634,8 +636,9 @@ public class PackageManagerService extends IPackageManager.Stub {
PackageParser.ActivityIntentInfo filter = filters.get(n);
filter.setVerified(verified);
- Slog.d(TAG, "IntentFilter " + filter.toString() + " verified with result:"
- + verified + " and hosts:" + ivs.getHostsString());
+ if (DEBUG_DOMAIN_VERIFICATION) Slog.d(TAG, "IntentFilter " + filter.toString()
+ + " verified with result:" + verified + " and hosts:"
+ + ivs.getHostsString());
}
mIntentFilterVerificationStates.remove(verificationId);
@@ -651,8 +654,8 @@ public class PackageManagerService extends IPackageManager.Stub {
+ verificationId + " packageName:" + packageName);
return;
}
- Slog.d(TAG, "Updating IntentFilterVerificationInfo for verificationId:"
- + verificationId);
+ if (DEBUG_DOMAIN_VERIFICATION) Slog.d(TAG,
+ "Updating IntentFilterVerificationInfo for verificationId:" + verificationId);
synchronized (mPackages) {
if (verified) {
@@ -707,7 +710,8 @@ public class PackageManagerService extends IPackageManager.Stub {
ActivityIntentInfo filter, String packageName) {
if (!(filter.hasDataScheme(IntentFilter.SCHEME_HTTP) ||
filter.hasDataScheme(IntentFilter.SCHEME_HTTPS))) {
- Slog.d(TAG, "IntentFilter does not contain HTTP nor HTTPS data scheme");
+ if (DEBUG_DOMAIN_VERIFICATION) Slog.d(TAG,
+ "IntentFilter does not contain HTTP nor HTTPS data scheme");
return false;
}
IntentFilterVerificationState ivs = mIntentFilterVerificationStates.get(verificationId);
@@ -736,16 +740,11 @@ public class PackageManagerService extends IPackageManager.Stub {
}
private static boolean hasValidDomains(ActivityIntentInfo filter) {
- return hasValidDomains(filter, true);
- }
-
- private static boolean hasValidDomains(ActivityIntentInfo filter, boolean logging) {
boolean hasHTTPorHTTPS = filter.hasDataScheme(IntentFilter.SCHEME_HTTP) ||
filter.hasDataScheme(IntentFilter.SCHEME_HTTPS);
if (!hasHTTPorHTTPS) {
- if (logging) {
- Slog.d(TAG, "IntentFilter does not contain any HTTP or HTTPS data scheme");
- }
+ if (DEBUG_DOMAIN_VERIFICATION) Slog.d(TAG,
+ "IntentFilter does not contain any HTTP or HTTPS data scheme");
return false;
}
return true;
@@ -1515,7 +1514,8 @@ public class PackageManagerService extends IPackageManager.Stub {
final int userId = state.getUserId();
- Slog.d(TAG, "Processing IntentFilter verification with token:"
+ if (DEBUG_DOMAIN_VERIFICATION) Slog.d(TAG,
+ "Processing IntentFilter verification with token:"
+ verificationId + " and userId:" + userId);
final IntentFilterVerificationResponse response =
@@ -1523,20 +1523,22 @@ public class PackageManagerService extends IPackageManager.Stub {
state.setVerifierResponse(response.callerUid, response.code);
- Slog.d(TAG, "IntentFilter verification with token:" + verificationId
+ if (DEBUG_DOMAIN_VERIFICATION) Slog.d(TAG,
+ "IntentFilter verification with token:" + verificationId
+ " and userId:" + userId
+ " is settings verifier response with response code:"
+ response.code);
if (response.code == PackageManager.INTENT_FILTER_VERIFICATION_FAILURE) {
- Slog.d(TAG, "Domains failing verification: "
+ if (DEBUG_DOMAIN_VERIFICATION) Slog.d(TAG, "Domains failing verification: "
+ response.getFailedDomainsString());
}
if (state.isVerificationComplete()) {
mIntentFilterVerifier.receiveVerificationResponse(verificationId);
} else {
- Slog.d(TAG, "IntentFilter verification with token:" + verificationId
+ if (DEBUG_DOMAIN_VERIFICATION) Slog.d(TAG,
+ "IntentFilter verification with token:" + verificationId
+ " was not said to be complete");
}
@@ -2160,7 +2162,7 @@ public class PackageManagerService extends IPackageManager.Stub {
mSettings.mFingerprint = Build.FINGERPRINT;
}
- primeDomainVerificationsLPw(false);
+ primeDomainVerificationsLPw();
checkDefaultBrowser();
// All the changes are done during package scanning.
@@ -2268,37 +2270,34 @@ public class PackageManagerService extends IPackageManager.Stub {
if (priority < info.priority) {
priority = info.priority;
verifierComponentName = new ComponentName(packageName, info.activityInfo.name);
- Slog.d(TAG, "Selecting IntentFilterVerifier: " + verifierComponentName +
- " with priority: " + info.priority);
+ if (DEBUG_DOMAIN_VERIFICATION) Slog.d(TAG, "Selecting IntentFilterVerifier: "
+ + verifierComponentName + " with priority: " + info.priority);
}
}
return verifierComponentName;
}
- private void primeDomainVerificationsLPw(boolean logging) {
- Slog.d(TAG, "Start priming domain verifications");
+ private void primeDomainVerificationsLPw() {
+ if (DEBUG_DOMAIN_VERIFICATION) Slog.d(TAG, "Start priming domain verifications");
boolean updated = false;
ArraySet<String> allHostsSet = new ArraySet<>();
for (PackageParser.Package pkg : mPackages.values()) {
final String packageName = pkg.packageName;
if (!hasDomainURLs(pkg)) {
- if (logging) {
- Slog.d(TAG, "No priming domain verifications for " +
+ if (DEBUG_DOMAIN_VERIFICATION) Slog.d(TAG, "No priming domain verifications for " +
"package with no domain URLs: " + packageName);
- }
continue;
}
if (!pkg.isSystemApp()) {
- if (logging) {
- Slog.d(TAG, "No priming domain verifications for a non system package : " +
- packageName);
- }
+ if (DEBUG_DOMAIN_VERIFICATION) Slog.d(TAG,
+ "No priming domain verifications for a non system package : " +
+ packageName);
continue;
}
for (PackageParser.Activity a : pkg.activities) {
for (ActivityIntentInfo filter : a.intents) {
- if (hasValidDomains(filter, false)) {
+ if (hasValidDomains(filter)) {
allHostsSet.addAll(filter.getHostsList());
}
}
@@ -2310,25 +2309,23 @@ public class PackageManagerService extends IPackageManager.Stub {
IntentFilterVerificationInfo ivi =
mSettings.createIntentFilterVerificationIfNeededLPw(packageName, allHostsList);
if (ivi != null) {
- // We will always log this
- Slog.d(TAG, "Priming domain verifications for package: " + packageName +
+ if (DEBUG_DOMAIN_VERIFICATION) Slog.d(TAG,
+ "Priming domain verifications for package: " + packageName +
" with hosts:" + ivi.getDomainsString());
ivi.setStatus(INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ALWAYS);
updated = true;
}
else {
- if (logging) {
- Slog.d(TAG, "No priming domain verifications for package: " + packageName);
- }
+ if (DEBUG_DOMAIN_VERIFICATION) Slog.d(TAG,
+ "No priming domain verifications for package: " + packageName);
}
allHostsSet.clear();
}
if (updated) {
- if (logging) {
- Slog.d(TAG, "Will need to write primed domain verifications");
- }
+ if (DEBUG_DOMAIN_VERIFICATION) Slog.d(TAG,
+ "Will need to write primed domain verifications");
}
- Slog.d(TAG, "End priming domain verifications");
+ if (DEBUG_DOMAIN_VERIFICATION) Slog.d(TAG, "End priming domain verifications");
}
private void checkDefaultBrowser() {
@@ -10344,7 +10341,7 @@ public class PackageManagerService extends IPackageManager.Stub {
int copyApk(IMediaContainerService imcs, boolean temp) throws RemoteException {
if (origin.staged) {
- Slog.d(TAG, origin.file + " already staged; skipping copy");
+ if (DEBUG_INSTALL) Slog.d(TAG, origin.file + " already staged; skipping copy");
codeFile = origin.file;
resourceFile = origin.file;
return PackageManager.INSTALL_SUCCEEDED;
@@ -10417,16 +10414,16 @@ public class PackageManagerService extends IPackageManager.Stub {
final File beforeCodeFile = codeFile;
final File afterCodeFile = getNextCodePath(targetDir, pkg.packageName);
- Slog.d(TAG, "Renaming " + beforeCodeFile + " to " + afterCodeFile);
+ if (DEBUG_INSTALL) Slog.d(TAG, "Renaming " + beforeCodeFile + " to " + afterCodeFile);
try {
Os.rename(beforeCodeFile.getAbsolutePath(), afterCodeFile.getAbsolutePath());
} catch (ErrnoException e) {
- Slog.d(TAG, "Failed to rename", e);
+ Slog.w(TAG, "Failed to rename", e);
return false;
}
if (!SELinux.restoreconRecursive(afterCodeFile)) {
- Slog.d(TAG, "Failed to restorecon");
+ Slog.w(TAG, "Failed to restorecon");
return false;
}
@@ -10589,7 +10586,7 @@ public class PackageManagerService extends IPackageManager.Stub {
int copyApk(IMediaContainerService imcs, boolean temp) throws RemoteException {
if (origin.staged) {
- Slog.d(TAG, origin.cid + " already staged; skipping copy");
+ if (DEBUG_INSTALL) Slog.d(TAG, origin.cid + " already staged; skipping copy");
cid = origin.cid;
setMountPath(PackageHelper.getSdDir(cid));
return PackageManager.INSTALL_SUCCEEDED;
@@ -10849,8 +10846,8 @@ public class PackageManagerService extends IPackageManager.Stub {
}
int copyApk(IMediaContainerService imcs, boolean temp) {
- Slog.d(TAG, "Moving " + move.packageName + " from " + move.fromUuid + " to "
- + move.toUuid);
+ if (DEBUG_INSTALL) Slog.d(TAG, "Moving " + move.packageName + " from "
+ + move.fromUuid + " to " + move.toUuid);
synchronized (mInstaller) {
if (mInstaller.moveCompleteApp(move.fromUuid, move.toUuid, move.packageName,
move.dataAppName, move.appId, move.seinfo) != 0) {
@@ -10860,7 +10857,7 @@ public class PackageManagerService extends IPackageManager.Stub {
codeFile = new File(Environment.getDataAppDirectory(move.toUuid), move.dataAppName);
resourceFile = codeFile;
- Slog.d(TAG, "codeFile after move is " + codeFile);
+ if (DEBUG_INSTALL) Slog.d(TAG, "codeFile after move is " + codeFile);
return PackageManager.INSTALL_SUCCEEDED;
}
@@ -11695,7 +11692,7 @@ public class PackageManagerService extends IPackageManager.Stub {
private void startIntentFilterVerifications(int userId, PackageParser.Package pkg) {
if (mIntentFilterVerifierComponent == null) {
- Slog.d(TAG, "No IntentFilter verification will not be done as "
+ Slog.w(TAG, "No IntentFilter verification will not be done as "
+ "there is no IntentFilterVerifier available!");
return;
}
@@ -11717,17 +11714,20 @@ public class PackageManagerService extends IPackageManager.Stub {
PackageParser.Package pkg) {
int size = pkg.activities.size();
if (size == 0) {
- Slog.d(TAG, "No activity, so no need to verify any IntentFilter!");
+ if (DEBUG_DOMAIN_VERIFICATION) Slog.d(TAG,
+ "No activity, so no need to verify any IntentFilter!");
return;
}
final boolean hasDomainURLs = hasDomainURLs(pkg);
if (!hasDomainURLs) {
- Slog.d(TAG, "No domain URLs, so no need to verify any IntentFilter!");
+ if (DEBUG_DOMAIN_VERIFICATION) Slog.d(TAG,
+ "No domain URLs, so no need to verify any IntentFilter!");
return;
}
- Slog.d(TAG, "Checking for userId:" + userId + " if any IntentFilter from the " + size
+ if (DEBUG_DOMAIN_VERIFICATION) Slog.d(TAG, "Checking for userId:" + userId
+ + " if any IntentFilter from the " + size
+ " Activities needs verification ...");
final int verificationId = mIntentFilterVerificationToken++;
@@ -11740,12 +11740,14 @@ public class PackageManagerService extends IPackageManager.Stub {
for (ActivityIntentInfo filter : a.intents) {
boolean needsFilterVerification = filter.needsVerification();
if (needsFilterVerification && needsNetworkVerificationLPr(filter)) {
- Slog.d(TAG, "Verification needed for IntentFilter:" + filter.toString());
+ if (DEBUG_DOMAIN_VERIFICATION) Slog.d(TAG,
+ "Verification needed for IntentFilter:" + filter.toString());
mIntentFilterVerifier.addOneIntentFilterVerification(
verifierUid, userId, verificationId, filter, packageName);
count++;
} else if (!needsFilterVerification) {
- Slog.d(TAG, "No verification needed for IntentFilter:" + filter.toString());
+ if (DEBUG_DOMAIN_VERIFICATION) Slog.d(TAG,
+ "No verification needed for IntentFilter:" + filter.toString());
if (hasValidDomains(filter)) {
ArrayList<String> hosts = filter.getHostsList();
if (hosts.size() > 0) {
@@ -11757,8 +11759,8 @@ public class PackageManagerService extends IPackageManager.Stub {
}
}
} else {
- Slog.d(TAG, "Verification already done for IntentFilter:"
- + filter.toString());
+ if (DEBUG_DOMAIN_VERIFICATION) Slog.d(TAG,
+ "Verification already done for IntentFilter:" + filter.toString());
}
}
}
@@ -11766,10 +11768,12 @@ public class PackageManagerService extends IPackageManager.Stub {
if (count > 0) {
mIntentFilterVerifier.startVerifications(userId);
- Slog.d(TAG, "Started " + count + " IntentFilter verification"
- + (count > 1 ? "s" : "") + " for userId:" + userId + "!");
+ if (DEBUG_DOMAIN_VERIFICATION) Slog.d(TAG, "Started " + count
+ + " IntentFilter verification" + (count > 1 ? "s" : "")
+ + " for userId:" + userId + "!");
} else {
- Slog.d(TAG, "No need to start any IntentFilter verification!");
+ if (DEBUG_DOMAIN_VERIFICATION) Slog.d(TAG,
+ "No need to start any IntentFilter verification!");
if (allHosts.size() > 0 && mSettings.createIntentFilterVerificationIfNeededLPw(
packageName, allHosts) != null) {
scheduleWriteSettingsLocked();
@@ -14558,7 +14562,7 @@ public class PackageManagerService extends IPackageManager.Stub {
}
}
- Slog.d(TAG, "Loaded packages " + loaded);
+ if (DEBUG_INSTALL) Slog.d(TAG, "Loaded packages " + loaded);
sendResourcesChangedBroadcast(true, false, loaded, null);
}
@@ -14584,7 +14588,7 @@ public class PackageManagerService extends IPackageManager.Stub {
}
}
- Slog.d(TAG, "Unloaded packages " + unloaded);
+ if (DEBUG_INSTALL) Slog.d(TAG, "Unloaded packages " + unloaded);
sendResourcesChangedBroadcast(false, false, unloaded, null);
}
@@ -14605,7 +14609,7 @@ public class PackageManagerService extends IPackageManager.Stub {
try {
movePackageInternal(packageName, volumeUuid, moveId);
} catch (PackageManagerException e) {
- Slog.d(TAG, "Failed to move " + packageName, e);
+ Slog.w(TAG, "Failed to move " + packageName, e);
mMoveCallbacks.notifyStatusChanged(moveId,
PackageManager.MOVE_FAILED_INTERNAL_ERROR);
}
@@ -14714,7 +14718,8 @@ public class PackageManagerService extends IPackageManager.Stub {
}
}
- Slog.d(TAG, "Measured code size " + stats.codeSize + ", data size " + stats.dataSize);
+ if (DEBUG_INSTALL) Slog.d(TAG, "Measured code size " + stats.codeSize + ", data size "
+ + stats.dataSize);
final long startFreeBytes = measurePath.getFreeSpace();
final long sizeBytes;
@@ -14742,7 +14747,7 @@ public class PackageManagerService extends IPackageManager.Stub {
@Override
public void onPackageInstalled(String basePackageName, int returnCode, String msg,
Bundle extras) throws RemoteException {
- Slog.d(TAG, "Install result for move: "
+ if (DEBUG_INSTALL) Slog.d(TAG, "Install result for move: "
+ PackageManager.installStatusToString(returnCode, msg));
installedLatch.countDown();
@@ -14891,7 +14896,7 @@ public class PackageManagerService extends IPackageManager.Stub {
for (VolumeInfo vol : vols) {
if (vol.getType() == VolumeInfo.TYPE_PRIVATE && vol.isMountedWritable()) {
final String volumeUuid = vol.getFsUuid();
- Slog.d(TAG, "Removing user data on volume " + volumeUuid);
+ if (DEBUG_INSTALL) Slog.d(TAG, "Removing user data on volume " + volumeUuid);
mInstaller.removeUserDataDirs(volumeUuid, userHandle);
}
}