Code example for Context

Methods: enforceCallingOrSelfPermission

0
            Binder.restoreCallingIdentity(identity);
        } 
    } 
 
    public void cancelVibrate() { 
        mContext.enforceCallingOrSelfPermission(
                android.Manifest.permission.VIBRATE,
                "cancelVibrate"); 
 
        // so wakelock calls will succeed 
        long identity = Binder.clearCallingIdentity();
        try { 
            doCancelVibrate(); 
        } 
        finally { 
            Binder.restoreCallingIdentity(identity);
        } 
    } 
     
    public boolean getFlashlightEnabled() { 
        return Hardware.getFlashlightEnabled();