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

Commit 51d94e9c authored by Steve Kondik's avatar Steve Kondik Committed by Gerrit Code Review
Browse files

Merge "Do not unlock when running in background" into gingerbread

parents 3977575b 05543317
Loading
Loading
Loading
Loading
+18 −3
Original line number Diff line number Diff line
@@ -52,6 +52,7 @@ import android.os.ParcelFileDescriptor;
import android.os.BatteryManager;
import android.os.SystemClock;
import android.os.SystemProperties;
import android.os.Vibrator;
import android.provider.Settings;

import java.util.ArrayList;
@@ -1199,7 +1200,7 @@ class LockScreen extends LinearLayout implements KeyguardScreen, KeyguardUpdateM
    public void onGesturePerformed(GestureOverlayView overlay, Gesture gesture) {
        ArrayList<Prediction> predictions = mLibrary.recognize(gesture);
        if (predictions.size() > 0 && predictions.get(0).score > mGestureSensitivity) {
            String[] payload = predictions.get(0).name.split("___", 2);
            String[] payload = predictions.get(0).name.split("___", 3);
            String uri = payload[1];
            if (uri != null) {
                if ("UNLOCK".equals(uri)) {
@@ -1216,7 +1217,20 @@ class LockScreen extends LinearLayout implements KeyguardScreen, KeyguardUpdateM
                        i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK
                                | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);
                        mContext.startActivity(i);
                        // Run in background if requested
                        if (payload.length > 2) {
                            // Define vibrator
                            Vibrator v = (Vibrator) mContext.getSystemService(Context.VIBRATOR_SERVICE);
                            // Vibrate pattern when gesture is correct
                            long[] pattern = {
                                0, 200
                            };
                            v.vibrate(pattern, -1);

                            mCallback.pokeWakelock();
                        } else {
                            mCallback.goToUnlockScreen();
                        }
                    } catch (URISyntaxException e) {
                    } catch (ActivityNotFoundException e) {
                    }
@@ -1225,6 +1239,7 @@ class LockScreen extends LinearLayout implements KeyguardScreen, KeyguardUpdateM
            mCallback.pokeWakelock(); // reset timeout - give them another chance to gesture
        }
    }

    // shameless kang of music widgets
    public static Uri getArtworkUri(Context context, long song_id, long album_id) {