Methods Summary |
---|
protected java.lang.String | composeChangeAnnouncement()
if (mState.value) {
return mContext.getString(R.string.accessibility_quick_settings_flashlight_changed_on);
} else {
return mContext.getString(R.string.accessibility_quick_settings_flashlight_changed_off);
}
|
protected void | handleClick()
if (ActivityManager.isUserAMonkey()) {
return;
}
boolean newState = !mState.value;
mFlashlightController.setFlashlight(newState);
refreshState(newState ? UserBoolean.USER_TRUE : UserBoolean.USER_FALSE);
|
protected void | handleDestroy()
super.handleDestroy();
mFlashlightController.removeListener(this);
|
protected void | handleUpdateState(BooleanState state, java.lang.Object arg)
if (state.value) {
mWasLastOn = SystemClock.uptimeMillis();
}
if (arg instanceof UserBoolean) {
state.value = ((UserBoolean) arg).value;
}
if (!state.value && mWasLastOn != 0) {
if (SystemClock.uptimeMillis() > mWasLastOn + RECENTLY_ON_DURATION_MILLIS) {
mWasLastOn = 0;
} else {
mHandler.removeCallbacks(mRecentlyOnTimeout);
mHandler.postAtTime(mRecentlyOnTimeout, mWasLastOn + RECENTLY_ON_DURATION_MILLIS);
}
}
// Always show the tile when the flashlight is or was recently on. This is needed because
// the camera is not available while it is being used for the flashlight.
state.visible = mWasLastOn != 0 || mFlashlightController.isAvailable();
state.label = mHost.getContext().getString(R.string.quick_settings_flashlight_label);
final AnimationIcon icon = state.value ? mEnable : mDisable;
icon.setAllowAnimation(arg instanceof UserBoolean && ((UserBoolean) arg).userInitiated);
state.icon = icon;
int onOrOffId = state.value
? R.string.accessibility_quick_settings_flashlight_on
: R.string.accessibility_quick_settings_flashlight_off;
state.contentDescription = mContext.getString(onOrOffId);
|
protected void | handleUserSwitch(int newUserId)
|
protected BooleanState | newTileState()
return new BooleanState();
|
public void | onFlashlightAvailabilityChanged(boolean available)
refreshState();
|
public void | onFlashlightError()
refreshState(UserBoolean.BACKGROUND_FALSE);
|
public void | onFlashlightOff()
refreshState(UserBoolean.BACKGROUND_FALSE);
|
public void | setListening(boolean listening)
|