Android system permissions set_preferred_applications how to get

Source: Internet
Author: User

Recently wrote a demo, need to use the Set_preferred_applications permission
On the internet for half a day, there are probably two ways:
1, after the phone root, the apk forcibly push to the System/app directory, restart the phone
2, Set_preferred_applications is the system authority, need to have the system Shareuserid and signature
The first one tried, no way.
The second way, because the use of their own company's mobile phone, know a shareuserid and signature,
But found that only one cell phone is available and no other phones can be used
Prompt error:
Java.lang.SecurityException:Neither User 10020 Nor current process have Android.permission.SET_PREFERRED_APPLICATIONS
Then there are a few questions in mind:
1, the role of the system signature is what, the most important role is to obtain system permissions?
If yes, then I know the Shareuserid and signature should not be sufficient to obtain the
Set_preferred_applications Permissions
2, Root after the third party signed APK, forcibly push to the System/app directory and installed in Data/app What is the difference? As far as I know the apk with system signature and Shareuserid will be installed in the System/app directory, then does the APK installed in the System/app directory have the same function as the system signature and Shareuserid APK installation?
3, such as silent installation, the need for System permissions bar (Specific what permissions I do not know, follow-up to Google), want to 360 mobile phone assistants, peas folder and other markets have the ability to implement silent installation after the phone root, then their system permissions (silent installation) How to obtain? (in order to get set_preferred_applications, I purposely put the phone root, but run have found no box request permission)

Hfgerr () Posted: 2013-02-21 11:11:04 1 floor

Google today, and learned the knowledge
Android privilege levels are divided into four categories:
["Normal" | "Dangerous" | "Signature" | "Signatureorsystem"]
Where normal and dangerous are general apk are declared in the mainifest can be obtained
Signature must have a system-level signature to obtain
Signatureorsystem has a system level signature or has system privileges
System permissions should be installed in the/system/app apk get, (and the system-level signature will also be installed in the/system/app directory)
If you want to use the third "signature" permission, then even if you root after the force of the APK push to/system/app
After restarting the phone in the directory is also unable to obtain this permission (this way can get to the fourth kind of permission "Signatureorsystem", the specific permissions between 3 and 4 is the intersection relationship or the relationship between, I do not understand:( )
Now I suspect that set_preferred_applications permissions belong to the third--"signature" permission, must have a system signature to obtain, I want to verify that I guess is correct, but I have not found how to view the Set_preferred_ Applications Permission Level method

Hfgerr () Posted: 2013-02-21 15:18:21 2 floor

Finally found a way to view permission specific information.
In the Android source Frameworks/base/core/res/androidmanifest.xml

Java Code

?

1

2

3

4

5

6

7

8

<!-- @deprecatedNo longer useful, see

{@linkandroid.content.pm.PackageManager#addPackageToPreferred}

fordetails. -->

<permission android:name="android.permission.SET_PREFERRED_APPLICATIONS"

android:permissionGroup="android.permission-group.SYSTEM_TOOLS"

android:protectionLevel="signature"

android:label="@string/permlab_setPreferredApplications"

android:description="@string/permdesc_setPreferredApplications"/>

Sure enough, set_preferred_applications grade is signature.
Ps:
1, silent installation can also be achieved by obtaining root privileges, and then in code by calling the Execute command line statement: PM INSTALL/SDCARD/**.APK,
2, installation required permissions: Android.permission.INSTALL_PACKAGES after the verification level is indeed Signature|system,
That is, in the absence of a system signature, force the APK, push to the/system/app directory can also get this permission

Android system permissions set_preferred_applications how to get

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.