Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e67268e6 authored by Selim Cinek's avatar Selim Cinek Committed by Android (Google) Code Review
Browse files

Merge "Migrate camera vibration to the systemUI" into mnc-dr-dev

parents 8ff73b59 69ff8afc
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -66,6 +66,7 @@ import android.os.ServiceManager;
import android.os.SystemClock;
import android.os.UserHandle;
import android.os.UserManager;
import android.os.Vibrator;
import android.provider.Settings;
import android.service.notification.NotificationListenerService;
import android.service.notification.NotificationListenerService.RankingMap;
@@ -484,6 +485,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
    private ExpandableNotificationRow mDraggedDownRow;
    private boolean mLaunchCameraOnScreenTurningOn;
    private PowerManager.WakeLock mGestureWakeLock;
    private Vibrator mVibrator;

    // Fingerprint (as computed by getLoggingFingerprint() of the last logged state.
    private int mLastLoggedStateFingerprint;
@@ -907,6 +909,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
                new Intent(pm.isScreenOn() ? Intent.ACTION_SCREEN_ON : Intent.ACTION_SCREEN_OFF));
        mGestureWakeLock = pm.newWakeLock(PowerManager.SCREEN_BRIGHT_WAKE_LOCK,
                "GestureWakeLock");
        mVibrator = mContext.getSystemService(Vibrator.class);

        // receive broadcasts
        IntentFilter filter = new IntentFilter();
@@ -3927,6 +3930,10 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
        }
    }

    private void vibrateForCameraGesture() {
        mVibrator.vibrate(1000L);
    }

    public void onScreenTurnedOn() {
        mDozeScrimController.onScreenTurnedOn();
    }
@@ -4091,6 +4098,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
            pm.wakeUp(SystemClock.uptimeMillis(), "com.android.systemui:CAMERA_GESTURE");
            mStatusBarKeyguardViewManager.notifyDeviceWakeUpRequested();
        }
        vibrateForCameraGesture();
        if (!mStatusBarKeyguardViewManager.isShowing()) {
            startActivity(KeyguardBottomAreaView.INSECURE_CAMERA_INTENT,
                    true /* dismissShade */);
+0 −6
Original line number Diff line number Diff line
@@ -53,7 +53,6 @@ class GestureLauncherService extends SystemService {
    private final GestureEventListener mGestureListener = new GestureEventListener();

    private Sensor mCameraLaunchSensor;
    private Vibrator mVibrator;
    private Context mContext;

    /** The wake lock held when a gesture is detected. */
@@ -78,7 +77,6 @@ class GestureLauncherService extends SystemService {
                return;
            }

            mVibrator = (Vibrator) mContext.getSystemService(Context.VIBRATOR_SERVICE);
            PowerManager powerManager = (PowerManager) mContext.getSystemService(
                    Context.POWER_SERVICE);
            mWakeLock = powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK,
@@ -222,16 +220,12 @@ class GestureLauncherService extends SystemService {
                    "userSetupComplete = %s, performing camera launch gesture.",
                    userSetupComplete));

            if (mVibrator != null && mVibrator.hasVibrator()) {
                mVibrator.vibrate(1000L);
            }
            // Make sure we don't sleep too early
            mWakeLock.acquire(500L);
            StatusBarManagerInternal service = LocalServices.getService(
                    StatusBarManagerInternal.class);
            service.onCameraLaunchGestureDetected();
            mWakeLock.release();

        }

        @Override