Metrics for update without user action change in S
Added an extra in the intent sent to the package verifier to track whether user action was requested for app installs. Bug: b/190368734 Test: None. Change-Id: I52090e2d241c8e0a308a77321cab4bf6341cfb9c
This commit is contained in:
@@ -4245,6 +4245,7 @@ public abstract class PackageManager {
|
||||
*/
|
||||
public static final String EXTRA_VERIFICATION_PACKAGE_NAME
|
||||
= "android.content.pm.extra.VERIFICATION_PACKAGE_NAME";
|
||||
|
||||
/**
|
||||
* Extra field name for the result of a verification, either
|
||||
* {@link #VERIFICATION_ALLOW}, or {@link #VERIFICATION_REJECT}.
|
||||
@@ -4253,6 +4254,14 @@ public abstract class PackageManager {
|
||||
public static final String EXTRA_VERIFICATION_RESULT
|
||||
= "android.content.pm.extra.VERIFICATION_RESULT";
|
||||
|
||||
/**
|
||||
* Extra field name for tracking whether user action
|
||||
* was requested for a particular install, either {@code true} or {@code false}.
|
||||
* @hide
|
||||
*/
|
||||
public static final String EXTRA_USER_ACTION_REQUIRED
|
||||
= "android.content.pm.extra.USER_ACTION_REQUIRED";
|
||||
|
||||
/**
|
||||
* Extra field name for the version code of a package pending verification.
|
||||
* @deprecated Use {@link #EXTRA_VERIFICATION_LONG_VERSION_CODE} instead.
|
||||
@@ -4263,8 +4272,7 @@ public abstract class PackageManager {
|
||||
= "android.content.pm.extra.VERIFICATION_VERSION_CODE";
|
||||
|
||||
/**
|
||||
* Extra field name for the long version code of a package pending verification.
|
||||
*
|
||||
* Extra field name for the long version code of a package pending verification
|
||||
* @hide
|
||||
*/
|
||||
public static final String EXTRA_VERIFICATION_LONG_VERSION_CODE =
|
||||
|
||||
@@ -299,6 +299,10 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub {
|
||||
final SessionParams params;
|
||||
final long createdMillis;
|
||||
|
||||
/** Used for tracking whether user action was required for an install. */
|
||||
@Nullable
|
||||
private Boolean mUserActionRequired;
|
||||
|
||||
/** Staging location where client data is written. */
|
||||
final File stageDir;
|
||||
final String stageCid;
|
||||
@@ -2131,8 +2135,16 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub {
|
||||
* in its belong session set. When the user answers the yes,
|
||||
* {@link #setPermissionsResult(boolean)} is called and then {@link #MSG_INSTALL} is
|
||||
* handled to come back here to check again.
|
||||
*
|
||||
* {@code mUserActionRequired} is used to track when user action is required for an
|
||||
* install. Since control may come back here more than 1 time, we must ensure that it's
|
||||
* value is not overwritten.
|
||||
*/
|
||||
if (sendPendingUserActionIntentIfNeeded()) {
|
||||
boolean wasUserActionIntentSent = sendPendingUserActionIntentIfNeeded();
|
||||
if (mUserActionRequired == null) {
|
||||
mUserActionRequired = wasUserActionIntentSent;
|
||||
}
|
||||
if (wasUserActionIntentSent) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -3323,6 +3335,18 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return a boolean value indicating whether user action was requested for the install.
|
||||
* Returns {@code false} if {@code mUserActionRequired} is {@code null}
|
||||
*/
|
||||
public boolean getUserActionRequired() {
|
||||
if (mUserActionRequired != null) {
|
||||
return mUserActionRequired.booleanValue();
|
||||
}
|
||||
Slog.wtf(TAG, "mUserActionRequired should not be null.");
|
||||
return false;
|
||||
}
|
||||
|
||||
private static String getRelativePath(File file, File base) throws IOException {
|
||||
final String pathStr = file.getAbsolutePath();
|
||||
final String baseStr = base.getAbsolutePath();
|
||||
|
||||
@@ -167,7 +167,7 @@ final class PackageSessionVerifier {
|
||||
}
|
||||
return new VerificationParams(user, session.stageDir, observer, session.params,
|
||||
session.getInstallSource(), session.getInstallerUid(), session.getSigningDetails(),
|
||||
session.sessionId, session.getPackageLite(), mPm);
|
||||
session.sessionId, session.getPackageLite(), session.getUserActionRequired(), mPm);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -123,6 +123,7 @@ final class VerificationParams extends HandlerParams {
|
||||
final long mRequiredInstalledVersionCode;
|
||||
final int mDataLoaderType;
|
||||
final int mSessionId;
|
||||
final boolean mUserActionRequired;
|
||||
|
||||
private boolean mWaitForVerificationToComplete;
|
||||
private boolean mWaitForIntegrityVerificationToComplete;
|
||||
@@ -135,7 +136,7 @@ final class VerificationParams extends HandlerParams {
|
||||
VerificationParams(UserHandle user, File stagedDir, IPackageInstallObserver2 observer,
|
||||
PackageInstaller.SessionParams sessionParams, InstallSource installSource,
|
||||
int installerUid, SigningDetails signingDetails, int sessionId, PackageLite lite,
|
||||
PackageManagerService pm) {
|
||||
boolean userActionRequired, PackageManagerService pm) {
|
||||
super(user, pm);
|
||||
mOriginInfo = OriginInfo.fromStagedFile(stagedDir);
|
||||
mObserver = observer;
|
||||
@@ -154,6 +155,7 @@ final class VerificationParams extends HandlerParams {
|
||||
? sessionParams.dataLoaderParams.getType() : DataLoaderType.NONE;
|
||||
mSessionId = sessionId;
|
||||
mPackageLite = lite;
|
||||
mUserActionRequired = userActionRequired;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -430,6 +432,8 @@ final class VerificationParams extends HandlerParams {
|
||||
|
||||
verification.putExtra(PackageInstaller.EXTRA_SESSION_ID, mSessionId);
|
||||
|
||||
verification.putExtra(PackageManager.EXTRA_USER_ACTION_REQUIRED, mUserActionRequired);
|
||||
|
||||
populateInstallerExtras(verification);
|
||||
|
||||
// Streaming installation timeout schema is enabled only for:
|
||||
|
||||
Reference in New Issue
Block a user