File tree Expand file tree Collapse file tree 2 files changed +25
-7
lines changed
core/java/android/provider
services/java/com/android/server/pm Expand file tree Collapse file tree 2 files changed +25
-7
lines changed Original file line number Diff line number Diff line change @@ -5334,25 +5334,34 @@ public static final class Global extends NameValueTable {
53345334 * review apps prior to installation.
53355335 * 1 = request apps to be verified prior to installation, if a verifier exists.
53365336 * 0 = do not verify apps before installation
5337- * { @hide}
5337+ * @hide
53385338 */
53395339 public static final String PACKAGE_VERIFIER_ENABLE = "package_verifier_enable" ;
53405340
53415341 /** Timeout for package verification.
5342- * { @hide} */
5342+ * @hide */
53435343 public static final String PACKAGE_VERIFIER_TIMEOUT = "verifier_timeout" ;
53445344
53455345 /** Default response code for package verification.
5346- * { @hide} */
5346+ * @hide */
53475347 public static final String PACKAGE_VERIFIER_DEFAULT_RESPONSE = "verifier_default_response" ;
53485348
5349- /** Show package verification setting in the Settings app.
5349+ /**
5350+ * Show package verification setting in the Settings app.
53505351 * 1 = show (default)
53515352 * 0 = hide
5352- * { @hide}
5353+ * @hide
53535354 */
53545355 public static final String PACKAGE_VERIFIER_SETTING_VISIBLE = "verifier_setting_visible" ;
53555356
5357+ /**
5358+ * Run package verificaiton on apps installed through ADB/ADT/USB
5359+ * 1 = perform package verification on ADB installs (default)
5360+ * 0 = bypass package verification on ADB installs
5361+ * @hide
5362+ */
5363+ public static final String PACKAGE_VERIFIER_INCLUDE_ADB = "verifier_verify_adb_installs" ;
5364+
53565365 /**
53575366 * The interval in milliseconds at which to check packet counts on the
53585367 * mobile data interface when screen is on, to detect possible data
Original file line number Diff line number Diff line change @@ -5904,11 +5904,20 @@ private int getDefaultVerificationResponse() {
59045904 *
59055905 * @return true if verification should be performed
59065906 */
5907- private boolean isVerificationEnabled () {
5907+ private boolean isVerificationEnabled (int flags ) {
59085908 if (!DEFAULT_VERIFY_ENABLE ) {
59095909 return false ;
59105910 }
59115911
5912+ // Check if installing from ADB
5913+ if ((flags & PackageManager .INSTALL_FROM_ADB ) != 0 ) {
5914+ // Check if the developer does not want package verification for ADB installs
5915+ if (android .provider .Settings .Global .getInt (mContext .getContentResolver (),
5916+ android .provider .Settings .Global .PACKAGE_VERIFIER_INCLUDE_ADB , 1 ) == 0 ) {
5917+ return false ;
5918+ }
5919+ }
5920+
59125921 return android .provider .Settings .Global .getInt (mContext .getContentResolver (),
59135922 android .provider .Settings .Global .PACKAGE_VERIFIER_ENABLE , 1 ) == 1 ;
59145923 }
@@ -6406,7 +6415,7 @@ public void handleStartCopy() throws RemoteException {
64066415 */
64076416 final int requiredUid = mRequiredVerifierPackage == null ? -1
64086417 : getPackageUid (mRequiredVerifierPackage , 0 );
6409- if (requiredUid != -1 && isVerificationEnabled ()) {
6418+ if (requiredUid != -1 && isVerificationEnabled (flags )) {
64106419 final Intent verification = new Intent (
64116420 Intent .ACTION_PACKAGE_NEEDS_VERIFICATION );
64126421 verification .setDataAndType (getPackageUri (), PACKAGE_MIME_TYPE );
You can’t perform that action at this time.
0 commit comments