Code example for Context

Methods: enforceCallingOrSelfPermission

0
                false, new SamplingProfilerSettingsObserver(contentResolver));
    } 
 
    @Override 
    protected void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
        mContext.enforceCallingOrSelfPermission(android.Manifest.permission.DUMP, TAG);
 
        pw.println("SamplingProfilerService:");
        pw.println("Watching directory: " + SNAPSHOT_DIR);
    } 
 
    private class SamplingProfilerSettingsObserver extends ContentObserver {
        private ContentResolver mContentResolver;
        public SamplingProfilerSettingsObserver(ContentResolver contentResolver) {
            super(null); 
            mContentResolver = contentResolver;
            onChange(false); 
        } 
        @Override 
        public void onChange(boolean selfChange) {
            Integer samplingProfilerMs = Settings.Global.getInt(