示例#1
0
 public void updateResources() {
   int resId;
   if (mCameraDisabled) {
     // Fall back to showing ring/silence if camera is disabled by DPM...
     resId =
         mSilentMode
             ? R.array.lockscreen_targets_when_silent
             : R.array.lockscreen_targets_when_soundon;
   } else {
     resId = R.array.lockscreen_targets_with_camera;
   }
   mMultiWaveView.setTargetResources(resId);
 }
示例#2
0
 MultiWaveViewMethods(MultiWaveView multiWaveView) {
   mMultiWaveView = multiWaveView;
   final boolean cameraDisabled =
       mLockPatternUtils.getDevicePolicyManager().getCameraDisabled(null);
   if (cameraDisabled) {
     Log.v(TAG, "Camera disabled by Device Policy");
     mCameraDisabled = true;
   } else {
     // Camera is enabled if resource is initially defined for MultiWaveView
     // in the lockscreen layout file
     mCameraDisabled =
         mMultiWaveView.getTargetResourceId() != R.array.lockscreen_targets_with_camera;
   }
 }
示例#3
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"));
  }
示例#4
0
 public void ping() {
   mMultiWaveView.ping();
 }
示例#5
0
 public void reset(boolean animate) {
   mMultiWaveView.reset(animate);
 }