FileDocCategorySizeDatePackage
RotationLockControllerImpl.javaAPI DocAndroid 5.1 API3064Thu Mar 12 22:22:42 GMT 2015com.android.systemui.statusbar.policy

RotationLockControllerImpl

public final class RotationLockControllerImpl extends Object implements RotationLockController
Platform implementation of the rotation lock controller.

Fields Summary
private final android.content.Context
mContext
private final CopyOnWriteArrayList
mCallbacks
private final RotationPolicy.RotationPolicyListener
mRotationPolicyListener
Constructors Summary
public RotationLockControllerImpl(android.content.Context context)


       
        mContext = context;
        setListening(true);
    
Methods Summary
public voidaddRotationLockControllerCallback(RotationLockControllerCallback callback)

        mCallbacks.add(callback);
        notifyChanged(callback);
    
public intgetRotationLockOrientation()

        return RotationPolicy.getRotationLockOrientation(mContext);
    
public booleanisRotationLockAffordanceVisible()

        return RotationPolicy.isRotationLockToggleVisible(mContext);
    
public booleanisRotationLocked()

        return RotationPolicy.isRotationLocked(mContext);
    
private voidnotifyChanged(RotationLockControllerCallback callback)

        callback.onRotationLockStateChanged(RotationPolicy.isRotationLocked(mContext),
                RotationPolicy.isRotationLockToggleVisible(mContext));
    
private voidnotifyChanged()

        for (RotationLockControllerCallback callback : mCallbacks) {
            notifyChanged(callback);
        }
    
public voidremoveRotationLockControllerCallback(RotationLockControllerCallback callback)

        mCallbacks.remove(callback);
    
public voidsetListening(boolean listening)

        if (listening) {
            RotationPolicy.registerRotationPolicyListener(mContext, mRotationPolicyListener,
                    UserHandle.USER_ALL);
        } else {
            RotationPolicy.unregisterRotationPolicyListener(mContext, mRotationPolicyListener);
        }
    
public voidsetRotationLocked(boolean locked)

        RotationPolicy.setRotationLock(mContext, locked);