Merge "Add setting to skip verifying ADB installs" into jb-mr1-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
04c2bb86ca
@@ -5334,25 +5334,34 @@ public final class Settings {
|
||||
* review apps prior to installation.
|
||||
* 1 = request apps to be verified prior to installation, if a verifier exists.
|
||||
* 0 = do not verify apps before installation
|
||||
* {@hide}
|
||||
* @hide
|
||||
*/
|
||||
public static final String PACKAGE_VERIFIER_ENABLE = "package_verifier_enable";
|
||||
|
||||
/** Timeout for package verification.
|
||||
* {@hide} */
|
||||
* @hide */
|
||||
public static final String PACKAGE_VERIFIER_TIMEOUT = "verifier_timeout";
|
||||
|
||||
/** Default response code for package verification.
|
||||
* {@hide} */
|
||||
* @hide */
|
||||
public static final String PACKAGE_VERIFIER_DEFAULT_RESPONSE = "verifier_default_response";
|
||||
|
||||
/** Show package verification setting in the Settings app.
|
||||
/**
|
||||
* Show package verification setting in the Settings app.
|
||||
* 1 = show (default)
|
||||
* 0 = hide
|
||||
* {@hide}
|
||||
* @hide
|
||||
*/
|
||||
public static final String PACKAGE_VERIFIER_SETTING_VISIBLE = "verifier_setting_visible";
|
||||
|
||||
/**
|
||||
* Run package verificaiton on apps installed through ADB/ADT/USB
|
||||
* 1 = perform package verification on ADB installs (default)
|
||||
* 0 = bypass package verification on ADB installs
|
||||
* @hide
|
||||
*/
|
||||
public static final String PACKAGE_VERIFIER_INCLUDE_ADB = "verifier_verify_adb_installs";
|
||||
|
||||
/**
|
||||
* The interval in milliseconds at which to check packet counts on the
|
||||
* mobile data interface when screen is on, to detect possible data
|
||||
|
||||
@@ -5904,11 +5904,20 @@ public class PackageManagerService extends IPackageManager.Stub {
|
||||
*
|
||||
* @return true if verification should be performed
|
||||
*/
|
||||
private boolean isVerificationEnabled() {
|
||||
private boolean isVerificationEnabled(int flags) {
|
||||
if (!DEFAULT_VERIFY_ENABLE) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check if installing from ADB
|
||||
if ((flags & PackageManager.INSTALL_FROM_ADB) != 0) {
|
||||
// Check if the developer does not want package verification for ADB installs
|
||||
if (android.provider.Settings.Global.getInt(mContext.getContentResolver(),
|
||||
android.provider.Settings.Global.PACKAGE_VERIFIER_INCLUDE_ADB, 1) == 0) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return android.provider.Settings.Global.getInt(mContext.getContentResolver(),
|
||||
android.provider.Settings.Global.PACKAGE_VERIFIER_ENABLE, 1) == 1;
|
||||
}
|
||||
@@ -6406,7 +6415,7 @@ public class PackageManagerService extends IPackageManager.Stub {
|
||||
*/
|
||||
final int requiredUid = mRequiredVerifierPackage == null ? -1
|
||||
: getPackageUid(mRequiredVerifierPackage, 0);
|
||||
if (requiredUid != -1 && isVerificationEnabled()) {
|
||||
if (requiredUid != -1 && isVerificationEnabled(flags)) {
|
||||
final Intent verification = new Intent(
|
||||
Intent.ACTION_PACKAGE_NEEDS_VERIFICATION);
|
||||
verification.setDataAndType(getPackageUri(), PACKAGE_MIME_TYPE);
|
||||
|
||||
Reference in New Issue
Block a user