トラッキング コード

7/28/2013

About AppOps in Android 4.3

Android 4.3 added "AppOps" whitch is like permission manager.


Points


  • added AppOpsManager, AppOpsService in the frameworks(Java Layer).
  • If you would like to use "AppOps", you can called getSystemService(Context.LAYOUT_INFLATER_SERVICE).
  • Each "Service" in frameworks decide to run operation, by obtaining a setting from the AppOpsService,
If you want to know more info, you should do grep "AppOpsManager.MODE_ALLOWED / MODE_IGNORED" in AOSP.




Create "AppOpsService" instance

AppOpsService is created in ActivityManagerService's constructor.

    private ActivityManagerService() {
        File systemDir = new File(dataDir, "system");
            :
        mAppOpsService = new AppOpsService(new File(systemDir, "appops.xml"));
            :
    }



Setting data of AppOpsManager

Setting data of AppOps is saved to xml file. Xml file is named "appops.xml". It is saved under the System directory.

public class AppOpsService extends IAppOpsService.Stub {
    public AppOpsService(File storagePath) {
        mFile = new AtomicFile(storagePath);
        mHandler = new Handler();
        readState();
    }

    void readState() {

    }
    void writeState() {

    }
}

Ckeck it

You should check many source in AOPS(android-4.3_r2.1).
Settings application
packages/apps/Settings/src/com/android/settings/applications
- AppOpsCategory.java
- AppOpsDetails.java
- AppOpsState.java
- AppOpsSummary.java


Frameworks
frameworks/base/core/java/android/app/ContextImpl.java
frameworks/base/core/java/android/app/AppOpsManager.java
frameworks/base/services/java/com/android/server/AppOpsService.java
frameworks/base/services/java/com/android/server/am/ActivityManagerService.java


No comments:

Post a Comment