예제 #1
0
 /** {@inheritDoc} */
 public void onRingerModeChanged(int state) {
   boolean silent = AudioManager.RINGER_MODE_NORMAL != state;
   if (silent != mSilentMode) {
     mSilentMode = silent;
     mUnlockWidgetMethods.updateResources();
   }
 }
예제 #2
0
 /** {@inheritDoc} */
 public void onPause() {
   mStatusViewManager.onPause();
   mUnlockWidgetMethods.reset(false);
 }
예제 #3
0
 public void run() {
   mUnlockWidgetMethods.ping();
 }
예제 #4
0
  /**
   * @param context Used to setup the view.
   * @param configuration The current configuration. Used to use when selecting layout, etc.
   * @param lockPatternUtils Used to know the state of the lock pattern settings.
   * @param updateMonitor Used to register for updates on various keyguard related state, and query
   *     the initial state at setup.
   * @param callback Used to communicate back to the host keyguard view.
   */
  LockScreen(
      Context context,
      Configuration configuration,
      LockPatternUtils lockPatternUtils,
      KeyguardUpdateMonitor updateMonitor,
      KeyguardScreenCallback callback) {
    super(context);
    mLockPatternUtils = lockPatternUtils;
    mUpdateMonitor = updateMonitor;
    mCallback = callback;

    mEnableMenuKeyInLockScreen = shouldEnableMenuKey();

    mCreationOrientation = configuration.orientation;

    mKeyboardHidden = configuration.hardKeyboardHidden;

    if (LockPatternKeyguardView.DEBUG_CONFIGURATION) {
      Log.v(TAG, "***** CREATING LOCK SCREEN", new RuntimeException());
      Log.v(
          TAG,
          "Cur orient="
              + mCreationOrientation
              + " res orient="
              + context.getResources().getConfiguration().orientation);
    }

    final LayoutInflater inflater = LayoutInflater.from(context);
    if (DBG) Log.v(TAG, "Creation orientation = " + mCreationOrientation);
    if (mCreationOrientation != Configuration.ORIENTATION_LANDSCAPE) {
      inflater.inflate(R.layout.keyguard_screen_tab_unlock, this, true);
    } else {
      inflater.inflate(R.layout.keyguard_screen_tab_unlock_land, this, true);
    }

    mStatusViewManager =
        new KeyguardStatusViewManager(this, mUpdateMonitor, mLockPatternUtils, mCallback, false);

    setFocusable(true);
    setFocusableInTouchMode(true);
    setDescendantFocusability(ViewGroup.FOCUS_BLOCK_DESCENDANTS);

    mAudioManager = (AudioManager) mContext.getSystemService(Context.AUDIO_SERVICE);
    mSilentMode = isSilentMode();

    mUnlockWidget = findViewById(R.id.unlock_widget);
    if (mUnlockWidget instanceof SlidingTab) {
      SlidingTab slidingTabView = (SlidingTab) mUnlockWidget;
      slidingTabView.setHoldAfterTrigger(true, false);
      slidingTabView.setLeftHintText(R.string.lockscreen_unlock_label);
      slidingTabView.setLeftTabResources(
          R.drawable.ic_jog_dial_unlock,
          R.drawable.jog_tab_target_green,
          R.drawable.jog_tab_bar_left_unlock,
          R.drawable.jog_tab_left_unlock);
      SlidingTabMethods slidingTabMethods = new SlidingTabMethods(slidingTabView);
      slidingTabView.setOnTriggerListener(slidingTabMethods);
      mUnlockWidgetMethods = slidingTabMethods;
    } else if (mUnlockWidget instanceof WaveView) {
      WaveView waveView = (WaveView) mUnlockWidget;
      WaveViewMethods waveViewMethods = new WaveViewMethods(waveView);
      waveView.setOnTriggerListener(waveViewMethods);
      mUnlockWidgetMethods = waveViewMethods;
    } else if (mUnlockWidget instanceof MultiWaveView) {
      MultiWaveView multiWaveView = (MultiWaveView) mUnlockWidget;
      MultiWaveViewMethods multiWaveViewMethods = new MultiWaveViewMethods(multiWaveView);
      multiWaveView.setOnTriggerListener(multiWaveViewMethods);
      mUnlockWidgetMethods = multiWaveViewMethods;
    } else {
      throw new IllegalStateException("Unrecognized unlock widget: " + mUnlockWidget);
    }

    // Update widget with initial ring state
    mUnlockWidgetMethods.updateResources();

    if (DBG)
      Log.v(
          TAG, "*** LockScreen accel is " + (mUnlockWidget.isHardwareAccelerated() ? "on" : "off"));
  }