RecoverySystem.installPackage - / cache / recovery / command: open failed: EACCESS (rejection allowed) - there is no permission after updating Android to 4.3+

I have already searched the Internet for an answer to my problem, but, unfortunately, I could not find a solution to my problem. I even wrote in this case on the official forum , unfortunately, the moderators could not cope with this problem. Below I describe the problem, hoping that someone had a similar problem and she knows the solution.

I made an application that works fine on Android 4.1, so I reject the problems associated with the lack of "something." At the moment, it seems that there is an error in new versions of android, because after updating to Android 4.3+ (API 18+) my application shows a message:

/ cache / recovery / command: open failed: EACCESS (permission denied)

My application is a system application, so the *.apk file was placed in the /system/app/ directory with the appropriate file permissions (chmod), so context.getApplicationInfo().flags & ApplicationInfo.FLAG_SYSTEM is 1.

Since the application uses the RecoverySystem.installPackage(...) method, I added permissions:

<uses-permission android:name="android.permission.ACCESS_CACHE_FILESYSTEM" /> <uses-permission android:name="android.permission.REBOOT" /> <uses-permission android:name="android.permission.DELETE_CACHE_FILES" /> <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />

More than the required minimum, because among other applications my application uses the RecoverySystem.verifyPackage(...) method RecoverySystem.verifyPackage(...) In addition, this method had problems after updating to Android 4.3+, but these problems were solved after adding one of (or all) permissions:

<uses-permission android:name="android.permission.WRITE_MEDIA_STORAGE"/> <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" />

Note: For testing, I added to the manifest file also all possible permissions that are available, but this does not solve the problem.

Once again, I want to emphasize that the application works correctly before upgrading to android 4.3+. After the update, an error message appears:

/ cache / recovery / command: open failed: EACCESS (permission denied)

This error occurs when the RecoverySystem.installPackage(...) method is called. ( FileWriter command = new FileWriter(COMMAND_FILE); where COMMAND_FILE == /cache/recovery/command )

I am not sure, but I think that one of the possible reasons may be an error in "bootable / recovery / recovery.c", but I can not find confirmation.

If anyone can help, I would be grateful.

PS To avoid unrest on the Internet, do not publish texts such as "use Google", "it was already - I saw it somewhere - but I can’t remember where," "I have the same problem / also does not work for me" , and other messages that do not help solve the problem.


@ shiri-hrw Thanks for the answer.

after adding android: sharedUserId = "com.google.uid.shared" to the application manifest (AndroidManifest.xml), an error occurred:

Installation error: INSTALL_FAILED_SHARED_USER_INCOMPATIBLE Please check the logcat output for more details. Launch canceled!

Logcat

The package com.example.test does not have signatures that correspond to those found in the common user com.google.uid.shared ; not paying attention!

and / or

The com.example.test package does not have signatures that match those found in the public file android.uid.system ; not paying attention!

You wrote:

... since your application is not signed with google signatures ...

but after applying the sign, using the * .pk8 and * .x509.pem files, which can be found in the build / target / product / security file in pulbic sdk.

java -jar SignApk.jar platform.x509.pem platform.pk8 Application.apk Application_signed.apk

and / or

java -jar SignApk.jar shared.x509.pem shared.pk8 Application.apk Application_signed.apk

the error is still happening.

When I click my application on the system / application (and reboots), the application does not appear in the applications.

+6
source share
2 answers

I had the same problem, but it was resolved. If you have firmware 4.3+, you must add android:sharedUserId="com.google.uid.shared" to your application manifest and click your application on the system / application .

To do this, you can strengthen your device. But after adding this, yours will not be installed, because during the installation of verifySignaturesLP the method from PackageManagerService will return false, since your application is not signed with google signatures, so you need to make changes to this method to check the package applications and return true.

You get this error because your application does not have signatures comparable to Google signals. Although you signed your application using * .pk, but that / these files / files do not contain the signature that Google uses to sign your application.

So, to install the application, you need to change the framework code, as I mentioned earlier. for example, you can change your verifySignaturesLP method to return true for your application.

Or the second option. If you cannot do this, I'm not sure, but you can try something else. Instead of using this common identifier, use the common identifier of other system applications on your device. for example I used android:sharedUserId="android.uid.system" Then make your device valid by typing below the command

 1. adb shell 2. setenforce 0 

Remember that after the above commands you should get Permissive instead of Enforcing for getenforce . And then try it. I am not 100% sure about this second option. Hope this second option works in your case.

0
source

If you are using KitKat (4.4) then put apk in / system / priv-app instead of / system / app.

0
source

All Articles