Android puts Google Play store in an unloaded area, login times SecurityException Error

Source: Internet
Author: User


customer demand requires Google Play Store (phonesky.apk) to be uninstalled and needs to be placed under System/vendor/operator/app. This will cause you to encounter the following error when logging in to the Play store and cannot use:
FATAL EXCEPTION:d Ownload-manager-thread
Process:com.android.vending, pid:3016
Java.lang.SecurityException:Invalid value for Is_public_api:null
...... ......


This is because non-system apps cannot have Android.permission.ACCESS_DOWNLOAD_MANAGER permissions, In the Insert function of Downloadprovider, checkinsertpermissions is called to check database operation permissions, as follows:




private void checkInsertPermissions(ContentValues values) {
    if (getContext().checkCallingOrSelfPermission(Downloads.Impl.PERMISSION_ACCESS)
            == PackageManager.PERMISSION_GRANTED) {
        return;
    }
  
    getContext().enforceCallingOrSelfPermission(android.Manifest.permission.INTERNET,
            "INTERNET permission is required to use the download manager");
  
    // ensure the request fits within the bounds of a public API request
    // first copy so we can remove values
    values = new ContentValues(values);
  
    // check columns whose values are restricted
    enforceAllowedValues(values, Downloads.Impl.COLUMN_IS_PUBLIC_API, Boolean.TRUE);
    ……
}

Since the Google Play store is placed in an unloaded area, its Downloads.Impl.COLUMN_IS_PUBLIC_API is empty and does not meet the conditions of true.








Solution:



"Method One" puts the Google Play store back into the System application area and does not do the uninstall process. This is simple, but does not meet customer demand.
"Method II" modified Packagemanagerservice source code, the Google Play store to do special processing, directly to give permission:




--- a/frameworks/base/services/java/com/android/server/pm/PackageManagerService.java
+++ b/frameworks/base/services/java/com/android/server/pm/PackageManagerService.java
@@ -5938,7 +5938,12 @@ public class PackageManagerService extends IPackageManager.Stub {
                             + ")");
                 }
             }
+       // TChip ZJ Add START:for Phoneshy Permission
+               if (pkg.packageName.equals("com.android.vending")){
+                       allowed = true;
+               }
+       // TChip ZJ Add END
        }
  
         if ((changedPermission || replace) && !ps.permissionsFixed &&
                 !isSystemApp(ps) || isUpdatedSystemApp(ps)){

That's all you can do.











Android puts Google Play store in an unloaded area, login times SecurityException Error


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.