Bhanu Kaushik
Bhanu Kaushik

Reputation: 864

Android Manifest.xml Parsing

I am new to android system development. I have some experience with android app development though. I Want to modify the android permissions model and need to provide extra set of permissions in my custom android flavor. As an example <uses-permission android:name="com.example.project.My_Permission_Setting" /> This is intended to be a developer side feature than being a user side feature.

Could anyone help me or point to a resource (other than Android Developers page :)) which gives me where the parsing of the manifest and handling of these permissions takes place..

Thanks in Advance !! :)

Upvotes: 0

Views: 1106

Answers (2)

Yury
Yury

Reputation: 20936

You can protect components of your application with your custom permissions. For this you should declare permission in your manifest file <permission>. Then in the declaration of your component (activity, service, broadcastreceiver, contentprovider) you should specify this permission in the property (android:permission="string").

If you want to add a permission that will protect a part of Android system then you need to dig into Android system programming. But I do not think that you need such type of permission.

EDIT:

You can specify your new permissions in the file frameworks/base/core/res/AndroidManifest.xml in Android sources. To check how Android parser works try to look at frameworks/base/services/java/com/android/server/PackageManagerService.java

Upvotes: 1

Givi
Givi

Reputation: 3283

I don't know if that's a full solution but I think that's a direction:

        PackageManager pm = context.getPackageManager();
        String permission = "YOUR.CUSTOM.PERMISSION";
        try
        {
            pm.getPermissionInfo(permission, PackageManager.GET_PERMISSIONS);
        } 
        catch (PackageManager.NameNotFoundException e) 
        {
           e.printStackTrace();
           // Your permission does not exist...
        }

Upvotes: 1

Related Questions