motorola: rename LineageActions to MotoActions
Change-Id: I07e4b35309b3a645fab5acfcd1d18f8c30109b92
This commit is contained in:
parent
ccde739ef1
commit
d2314727ed
@ -5,7 +5,7 @@ LOCAL_MODULE_TAGS := optional
|
|||||||
|
|
||||||
LOCAL_SRC_FILES := $(call all-java-files-under, src)
|
LOCAL_SRC_FILES := $(call all-java-files-under, src)
|
||||||
|
|
||||||
LOCAL_PACKAGE_NAME := LineageActions
|
LOCAL_PACKAGE_NAME := MotoActions
|
||||||
LOCAL_CERTIFICATE := platform
|
LOCAL_CERTIFICATE := platform
|
||||||
LOCAL_PRIVATE_PLATFORM_APIS := true
|
LOCAL_PRIVATE_PLATFORM_APIS := true
|
||||||
LOCAL_USE_AAPT2 := true
|
LOCAL_USE_AAPT2 := true
|
@ -34,7 +34,7 @@
|
|||||||
<activity
|
<activity
|
||||||
android:name=".DozePreferenceActivity"
|
android:name=".DozePreferenceActivity"
|
||||||
android:label="@string/ambient_display_gestures_title"
|
android:label="@string/ambient_display_gestures_title"
|
||||||
android:theme="@style/LineageActions">
|
android:theme="@style/MotoActions">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="com.android.settings.action.IA_SETTINGS" />
|
<action android:name="com.android.settings.action.IA_SETTINGS" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
@ -49,7 +49,7 @@
|
|||||||
<activity
|
<activity
|
||||||
android:name=".ActionsPreferenceActivity"
|
android:name=".ActionsPreferenceActivity"
|
||||||
android:label="@string/moto_gestures_panel_title"
|
android:label="@string/moto_gestures_panel_title"
|
||||||
android:theme="@style/LineageActions">
|
android:theme="@style/MotoActions">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="com.android.settings.action.IA_SETTINGS" />
|
<action android:name="com.android.settings.action.IA_SETTINGS" />
|
||||||
</intent-filter>
|
</intent-filter>
|
@ -1,4 +1,4 @@
|
|||||||
-keep class org.lineageos.LineageActions.* {
|
-keep class org.lineageos.MotoActions.* {
|
||||||
*;
|
*;
|
||||||
}
|
}
|
||||||
|
|
@ -16,7 +16,7 @@
|
|||||||
limitations under the License.
|
limitations under the License.
|
||||||
-->
|
-->
|
||||||
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
|
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
|
||||||
<style name="LineageActions" parent="@android:style/Theme.DeviceDefault.Settings">
|
<style name="MotoActions" parent="@android:style/Theme.DeviceDefault.Settings">
|
||||||
<item name="preferenceCategoryStyle">@style/SettingsTheme.PreferenceCategoryStyle</item>
|
<item name="preferenceCategoryStyle">@style/SettingsTheme.PreferenceCategoryStyle</item>
|
||||||
<item name="preferenceTheme">@style/SettingsTheme.Preference</item>
|
<item name="preferenceTheme">@style/SettingsTheme.Preference</item>
|
||||||
<item name="switchPreferenceStyle">@style/SettingsTheme.SwitchPreferenceStyle</item>
|
<item name="switchPreferenceStyle">@style/SettingsTheme.SwitchPreferenceStyle</item>
|
@ -28,7 +28,7 @@ import android.util.Log;
|
|||||||
import org.lineageos.settings.device.ServiceWrapper.LocalBinder;
|
import org.lineageos.settings.device.ServiceWrapper.LocalBinder;
|
||||||
|
|
||||||
public class BootCompletedReceiver extends BroadcastReceiver {
|
public class BootCompletedReceiver extends BroadcastReceiver {
|
||||||
static final String TAG = "LineageActions";
|
static final String TAG = "MotoActions";
|
||||||
private ServiceWrapper mServiceWrapper;
|
private ServiceWrapper mServiceWrapper;
|
||||||
|
|
||||||
@Override
|
@Override
|
@ -38,8 +38,8 @@ public class DozePreferenceActivity extends PreferenceActivity {
|
|||||||
@Override
|
@Override
|
||||||
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
|
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
|
||||||
addPreferencesFromResource(R.xml.doze_panel);
|
addPreferencesFromResource(R.xml.doze_panel);
|
||||||
boolean dozeEnabled = LineageActionsSettings.isDozeEnabled(getActivity());
|
boolean dozeEnabled = MotoActionsSettings.isDozeEnabled(getActivity());
|
||||||
boolean aodEnabled = LineageActionsSettings.isAODEnabled(getActivity());
|
boolean aodEnabled = MotoActionsSettings.isAODEnabled(getActivity());
|
||||||
PreferenceCategory ambientDisplayCat = (PreferenceCategory)
|
PreferenceCategory ambientDisplayCat = (PreferenceCategory)
|
||||||
findPreference(CATEGORY_AMBIENT_DISPLAY);
|
findPreference(CATEGORY_AMBIENT_DISPLAY);
|
||||||
if (ambientDisplayCat != null) {
|
if (ambientDisplayCat != null) {
|
@ -42,9 +42,9 @@ import org.lineageos.settings.device.doze.ScreenReceiver;
|
|||||||
import org.lineageos.settings.device.doze.ScreenStateNotifier;
|
import org.lineageos.settings.device.doze.ScreenStateNotifier;
|
||||||
import org.lineageos.settings.device.doze.StowSensor;
|
import org.lineageos.settings.device.doze.StowSensor;
|
||||||
|
|
||||||
public class LineageActionsService extends IntentService implements ScreenStateNotifier,
|
public class MotoActionsService extends IntentService implements ScreenStateNotifier,
|
||||||
UpdatedStateNotifier {
|
UpdatedStateNotifier {
|
||||||
private static final String TAG = "LineageActions";
|
private static final String TAG = "MotoActions";
|
||||||
|
|
||||||
private final Context mContext;
|
private final Context mContext;
|
||||||
|
|
||||||
@ -58,13 +58,13 @@ public class LineageActionsService extends IntentService implements ScreenStateN
|
|||||||
private final List<UpdatedStateNotifier> mUpdatedStateNotifiers =
|
private final List<UpdatedStateNotifier> mUpdatedStateNotifiers =
|
||||||
new LinkedList<UpdatedStateNotifier>();
|
new LinkedList<UpdatedStateNotifier>();
|
||||||
|
|
||||||
public LineageActionsService(Context context) {
|
public MotoActionsService(Context context) {
|
||||||
super("LineageActionService");
|
super("MotoActionservice");
|
||||||
mContext = context;
|
mContext = context;
|
||||||
|
|
||||||
Log.d(TAG, "Starting");
|
Log.d(TAG, "Starting");
|
||||||
|
|
||||||
LineageActionsSettings lineageActionsSettings = new LineageActionsSettings(context, this);
|
MotoActionsSettings MotoActionsSettings = new MotoActionsSettings(context, this);
|
||||||
mSensorHelper = new SensorHelper(context);
|
mSensorHelper = new SensorHelper(context);
|
||||||
mScreenReceiver = new ScreenReceiver(context, this);
|
mScreenReceiver = new ScreenReceiver(context, this);
|
||||||
|
|
||||||
@ -72,20 +72,20 @@ public class LineageActionsService extends IntentService implements ScreenStateN
|
|||||||
mScreenStateNotifiers.add(mDozePulseAction);
|
mScreenStateNotifiers.add(mDozePulseAction);
|
||||||
|
|
||||||
// Actionable sensors get screen on/off notifications
|
// Actionable sensors get screen on/off notifications
|
||||||
mScreenStateNotifiers.add(new GlanceSensor(lineageActionsSettings, mSensorHelper, mDozePulseAction));
|
mScreenStateNotifiers.add(new GlanceSensor(MotoActionsSettings, mSensorHelper, mDozePulseAction));
|
||||||
mScreenStateNotifiers.add(new ProximitySensor(lineageActionsSettings, mSensorHelper, mDozePulseAction));
|
mScreenStateNotifiers.add(new ProximitySensor(MotoActionsSettings, mSensorHelper, mDozePulseAction));
|
||||||
mScreenStateNotifiers.add(new StowSensor(lineageActionsSettings, mSensorHelper, mDozePulseAction));
|
mScreenStateNotifiers.add(new StowSensor(MotoActionsSettings, mSensorHelper, mDozePulseAction));
|
||||||
mScreenStateNotifiers.add(new FlatUpSensor(lineageActionsSettings, mSensorHelper, mDozePulseAction));
|
mScreenStateNotifiers.add(new FlatUpSensor(MotoActionsSettings, mSensorHelper, mDozePulseAction));
|
||||||
|
|
||||||
// Other actions that are always enabled
|
// Other actions that are always enabled
|
||||||
mUpdatedStateNotifiers.add(new CameraActivationSensor(lineageActionsSettings, mSensorHelper));
|
mUpdatedStateNotifiers.add(new CameraActivationSensor(MotoActionsSettings, mSensorHelper));
|
||||||
mUpdatedStateNotifiers.add(new ChopChopSensor(lineageActionsSettings, mSensorHelper));
|
mUpdatedStateNotifiers.add(new ChopChopSensor(MotoActionsSettings, mSensorHelper));
|
||||||
mUpdatedStateNotifiers.add(new ProximitySilencer(lineageActionsSettings, context, mSensorHelper));
|
mUpdatedStateNotifiers.add(new ProximitySilencer(MotoActionsSettings, context, mSensorHelper));
|
||||||
mUpdatedStateNotifiers.add(new FlipToMute(lineageActionsSettings, context, mSensorHelper));
|
mUpdatedStateNotifiers.add(new FlipToMute(MotoActionsSettings, context, mSensorHelper));
|
||||||
mUpdatedStateNotifiers.add(new LiftToSilence(lineageActionsSettings, context, mSensorHelper));
|
mUpdatedStateNotifiers.add(new LiftToSilence(MotoActionsSettings, context, mSensorHelper));
|
||||||
|
|
||||||
mPowerManager = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
|
mPowerManager = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
|
||||||
mWakeLock = mPowerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "LineageActionsWakeLock");
|
mWakeLock = mPowerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "MotoActionsWakeLock");
|
||||||
updateState();
|
updateState();
|
||||||
}
|
}
|
||||||
|
|
@ -27,8 +27,8 @@ import org.lineageos.settings.device.actions.UpdatedStateNotifier;
|
|||||||
import org.lineageos.settings.device.actions.CameraActivationAction;
|
import org.lineageos.settings.device.actions.CameraActivationAction;
|
||||||
import org.lineageos.settings.device.actions.TorchAction;
|
import org.lineageos.settings.device.actions.TorchAction;
|
||||||
|
|
||||||
public class LineageActionsSettings {
|
public class MotoActionsSettings {
|
||||||
private static final String TAG = "LineageActions";
|
private static final String TAG = "MotoActions";
|
||||||
|
|
||||||
private static final String GESTURE_CAMERA_ACTION_KEY = "gesture_camera_action";
|
private static final String GESTURE_CAMERA_ACTION_KEY = "gesture_camera_action";
|
||||||
private static final String GESTURE_CHOP_CHOP_KEY = "gesture_chop_chop";
|
private static final String GESTURE_CHOP_CHOP_KEY = "gesture_chop_chop";
|
||||||
@ -49,7 +49,7 @@ public class LineageActionsSettings {
|
|||||||
private boolean mFlipToMuteEnabled;
|
private boolean mFlipToMuteEnabled;
|
||||||
private boolean mLiftToSilenceEnabled;
|
private boolean mLiftToSilenceEnabled;
|
||||||
|
|
||||||
public LineageActionsSettings(Context context, UpdatedStateNotifier updatedStateNotifier) {
|
public MotoActionsSettings(Context context, UpdatedStateNotifier updatedStateNotifier) {
|
||||||
SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(context);
|
SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||||
loadPreferences(sharedPrefs);
|
loadPreferences(sharedPrefs);
|
||||||
sharedPrefs.registerOnSharedPreferenceChangeListener(mPrefListener);
|
sharedPrefs.registerOnSharedPreferenceChangeListener(mPrefListener);
|
@ -30,7 +30,7 @@ import android.hardware.TriggerEventListener;
|
|||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
public class SensorHelper {
|
public class SensorHelper {
|
||||||
private static final String TAG = "LineageActions";
|
private static final String TAG = "MotoActions";
|
||||||
|
|
||||||
private static final int SENSOR_TYPE_MMI_CAMERA_ACTIVATION = 65540;
|
private static final int SENSOR_TYPE_MMI_CAMERA_ACTIVATION = 65540;
|
||||||
private static final int SENSOR_TYPE_MMI_CHOP_CHOP = 65546;
|
private static final int SENSOR_TYPE_MMI_CHOP_CHOP = 65546;
|
@ -24,10 +24,10 @@ import android.os.IBinder;
|
|||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
public class ServiceWrapper extends android.app.Service {
|
public class ServiceWrapper extends android.app.Service {
|
||||||
static final String TAG = "LineageActions-ServiceWrapper";
|
static final String TAG = "MotoActions-ServiceWrapper";
|
||||||
|
|
||||||
private final IBinder mBinder = new LocalBinder();
|
private final IBinder mBinder = new LocalBinder();
|
||||||
private LineageActionsService mLineageActionsService;
|
private MotoActionsService mMotoActionsService;
|
||||||
|
|
||||||
public interface ServiceCallback {
|
public interface ServiceCallback {
|
||||||
void sendResults(int resultCode, Bundle b);
|
void sendResults(int resultCode, Bundle b);
|
||||||
@ -45,7 +45,7 @@ public class ServiceWrapper extends android.app.Service {
|
|||||||
public void onCreate() {
|
public void onCreate() {
|
||||||
Log.i(TAG, "onCreate");
|
Log.i(TAG, "onCreate");
|
||||||
super.onCreate();
|
super.onCreate();
|
||||||
mLineageActionsService = new LineageActionsService(this);
|
mMotoActionsService = new MotoActionsService(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
@ -35,7 +35,7 @@ import android.util.Log;
|
|||||||
import org.lineageos.settings.device.SensorAction;
|
import org.lineageos.settings.device.SensorAction;
|
||||||
|
|
||||||
public class CameraActivationAction implements SensorAction {
|
public class CameraActivationAction implements SensorAction {
|
||||||
private static final String TAG = "LineageActions";
|
private static final String TAG = "MotoActions";
|
||||||
|
|
||||||
private static final int TURN_SCREEN_ON_WAKE_LOCK_MS = 500;
|
private static final int TURN_SCREEN_ON_WAKE_LOCK_MS = 500;
|
||||||
|
|
@ -25,23 +25,23 @@ import android.hardware.SensorEventListener;
|
|||||||
import android.hardware.SensorManager;
|
import android.hardware.SensorManager;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
import org.lineageos.settings.device.LineageActionsSettings;
|
import org.lineageos.settings.device.MotoActionsSettings;
|
||||||
import org.lineageos.settings.device.SensorHelper;
|
import org.lineageos.settings.device.SensorHelper;
|
||||||
|
|
||||||
public class CameraActivationSensor implements SensorEventListener, UpdatedStateNotifier {
|
public class CameraActivationSensor implements SensorEventListener, UpdatedStateNotifier {
|
||||||
private static final String TAG = "LineageActions-CameraSensor";
|
private static final String TAG = "MotoActions-CameraSensor";
|
||||||
|
|
||||||
private static final int TURN_SCREEN_ON_WAKE_LOCK_MS = 500;
|
private static final int TURN_SCREEN_ON_WAKE_LOCK_MS = 500;
|
||||||
|
|
||||||
private final LineageActionsSettings mLineageActionsSettings;
|
private final MotoActionsSettings mMotoActionsSettings;
|
||||||
private final SensorHelper mSensorHelper;
|
private final SensorHelper mSensorHelper;
|
||||||
|
|
||||||
private final Sensor mSensor;
|
private final Sensor mSensor;
|
||||||
|
|
||||||
private boolean mIsEnabled;
|
private boolean mIsEnabled;
|
||||||
|
|
||||||
public CameraActivationSensor(LineageActionsSettings lineageActionsSettings, SensorHelper sensorHelper) {
|
public CameraActivationSensor(MotoActionsSettings MotoActionsSettings, SensorHelper sensorHelper) {
|
||||||
mLineageActionsSettings = lineageActionsSettings;
|
mMotoActionsSettings = MotoActionsSettings;
|
||||||
mSensorHelper = sensorHelper;
|
mSensorHelper = sensorHelper;
|
||||||
mSensor = sensorHelper.getCameraActivationSensor();
|
mSensor = sensorHelper.getCameraActivationSensor();
|
||||||
mSensorHelper.registerListener(mSensor, this);
|
mSensorHelper.registerListener(mSensor, this);
|
||||||
@ -49,10 +49,10 @@ public class CameraActivationSensor implements SensorEventListener, UpdatedState
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public synchronized void updateState() {
|
public synchronized void updateState() {
|
||||||
if (mLineageActionsSettings.isCameraGestureEnabled() && !mIsEnabled) {
|
if (mMotoActionsSettings.isCameraGestureEnabled() && !mIsEnabled) {
|
||||||
Log.d(TAG, "Enabling");
|
Log.d(TAG, "Enabling");
|
||||||
mIsEnabled = true;
|
mIsEnabled = true;
|
||||||
} else if (! mLineageActionsSettings.isCameraGestureEnabled() && mIsEnabled) {
|
} else if (! mMotoActionsSettings.isCameraGestureEnabled() && mIsEnabled) {
|
||||||
Log.d(TAG, "Disabling");
|
Log.d(TAG, "Disabling");
|
||||||
mIsEnabled = false;
|
mIsEnabled = false;
|
||||||
}
|
}
|
||||||
@ -61,7 +61,7 @@ public class CameraActivationSensor implements SensorEventListener, UpdatedState
|
|||||||
@Override
|
@Override
|
||||||
public void onSensorChanged(SensorEvent event) {
|
public void onSensorChanged(SensorEvent event) {
|
||||||
Log.d(TAG, "activate camera");
|
Log.d(TAG, "activate camera");
|
||||||
if (mIsEnabled) mLineageActionsSettings.cameraAction();
|
if (mIsEnabled) mMotoActionsSettings.cameraAction();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
@ -25,15 +25,15 @@ import android.hardware.SensorEventListener;
|
|||||||
import android.hardware.SensorManager;
|
import android.hardware.SensorManager;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
import org.lineageos.settings.device.LineageActionsSettings;
|
import org.lineageos.settings.device.MotoActionsSettings;
|
||||||
import org.lineageos.settings.device.SensorHelper;
|
import org.lineageos.settings.device.SensorHelper;
|
||||||
|
|
||||||
public class ChopChopSensor implements SensorEventListener, UpdatedStateNotifier {
|
public class ChopChopSensor implements SensorEventListener, UpdatedStateNotifier {
|
||||||
private static final String TAG = "LineageActions-ChopChopSensor";
|
private static final String TAG = "MotoActions-ChopChopSensor";
|
||||||
|
|
||||||
private static final int TURN_SCREEN_ON_WAKE_LOCK_MS = 500;
|
private static final int TURN_SCREEN_ON_WAKE_LOCK_MS = 500;
|
||||||
|
|
||||||
private final LineageActionsSettings mLineageActionsSettings;
|
private final MotoActionsSettings mMotoActionsSettings;
|
||||||
private final SensorHelper mSensorHelper;
|
private final SensorHelper mSensorHelper;
|
||||||
private final Sensor mSensor;
|
private final Sensor mSensor;
|
||||||
private final Sensor mProx;
|
private final Sensor mProx;
|
||||||
@ -41,8 +41,8 @@ public class ChopChopSensor implements SensorEventListener, UpdatedStateNotifier
|
|||||||
private boolean mIsEnabled;
|
private boolean mIsEnabled;
|
||||||
private boolean mProxIsCovered;
|
private boolean mProxIsCovered;
|
||||||
|
|
||||||
public ChopChopSensor(LineageActionsSettings lineageActionsSettings, SensorHelper sensorHelper) {
|
public ChopChopSensor(MotoActionsSettings MotoActionsSettings, SensorHelper sensorHelper) {
|
||||||
mLineageActionsSettings = lineageActionsSettings;
|
mMotoActionsSettings = MotoActionsSettings;
|
||||||
mSensorHelper = sensorHelper;
|
mSensorHelper = sensorHelper;
|
||||||
mSensor = sensorHelper.getChopChopSensor();
|
mSensor = sensorHelper.getChopChopSensor();
|
||||||
mProx = sensorHelper.getProximitySensor();
|
mProx = sensorHelper.getProximitySensor();
|
||||||
@ -50,12 +50,12 @@ public class ChopChopSensor implements SensorEventListener, UpdatedStateNotifier
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public synchronized void updateState() {
|
public synchronized void updateState() {
|
||||||
if (mLineageActionsSettings.isChopChopGestureEnabled() && !mIsEnabled) {
|
if (mMotoActionsSettings.isChopChopGestureEnabled() && !mIsEnabled) {
|
||||||
Log.d(TAG, "Enabling");
|
Log.d(TAG, "Enabling");
|
||||||
mSensorHelper.registerListener(mSensor, this);
|
mSensorHelper.registerListener(mSensor, this);
|
||||||
mSensorHelper.registerListener(mProx, mProxListener);
|
mSensorHelper.registerListener(mProx, mProxListener);
|
||||||
mIsEnabled = true;
|
mIsEnabled = true;
|
||||||
} else if (! mLineageActionsSettings.isChopChopGestureEnabled() && mIsEnabled) {
|
} else if (! mMotoActionsSettings.isChopChopGestureEnabled() && mIsEnabled) {
|
||||||
Log.d(TAG, "Disabling");
|
Log.d(TAG, "Disabling");
|
||||||
mSensorHelper.unregisterListener(this);
|
mSensorHelper.unregisterListener(this);
|
||||||
mSensorHelper.unregisterListener(mProxListener);
|
mSensorHelper.unregisterListener(mProxListener);
|
||||||
@ -70,7 +70,7 @@ public class ChopChopSensor implements SensorEventListener, UpdatedStateNotifier
|
|||||||
Log.d(TAG, "proximity sensor covered, ignoring chop-chop");
|
Log.d(TAG, "proximity sensor covered, ignoring chop-chop");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
mLineageActionsSettings.chopChopAction();
|
mMotoActionsSettings.chopChopAction();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
@ -27,14 +27,14 @@ import android.hardware.SensorEvent;
|
|||||||
import android.hardware.SensorEventListener;
|
import android.hardware.SensorEventListener;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
import org.lineageos.settings.device.LineageActionsSettings;
|
import org.lineageos.settings.device.MotoActionsSettings;
|
||||||
import org.lineageos.settings.device.SensorHelper;
|
import org.lineageos.settings.device.SensorHelper;
|
||||||
|
|
||||||
public class FlipToMute implements UpdatedStateNotifier {
|
public class FlipToMute implements UpdatedStateNotifier {
|
||||||
private static final String TAG = "LineageActions-FlipToMute";
|
private static final String TAG = "MotoActions-FlipToMute";
|
||||||
|
|
||||||
private final NotificationManager mNotificationManager;
|
private final NotificationManager mNotificationManager;
|
||||||
private final LineageActionsSettings mLineageActionsSettings;
|
private final MotoActionsSettings mMotoActionsSettings;
|
||||||
private final SensorHelper mSensorHelper;
|
private final SensorHelper mSensorHelper;
|
||||||
private final Sensor mFlatDown;
|
private final Sensor mFlatDown;
|
||||||
private final Sensor mStow;
|
private final Sensor mStow;
|
||||||
@ -46,9 +46,9 @@ public class FlipToMute implements UpdatedStateNotifier {
|
|||||||
private Context mContext;
|
private Context mContext;
|
||||||
private Receiver mReceiver;
|
private Receiver mReceiver;
|
||||||
|
|
||||||
public FlipToMute(LineageActionsSettings lineageActionsSettings, Context context,
|
public FlipToMute(MotoActionsSettings MotoActionsSettings, Context context,
|
||||||
SensorHelper sensorHelper) {
|
SensorHelper sensorHelper) {
|
||||||
mLineageActionsSettings = lineageActionsSettings;
|
mMotoActionsSettings = MotoActionsSettings;
|
||||||
mContext = context;
|
mContext = context;
|
||||||
mSensorHelper = sensorHelper;
|
mSensorHelper = sensorHelper;
|
||||||
mFlatDown = sensorHelper.getFlatDownSensor();
|
mFlatDown = sensorHelper.getFlatDownSensor();
|
||||||
@ -61,14 +61,14 @@ public class FlipToMute implements UpdatedStateNotifier {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateState() {
|
public void updateState() {
|
||||||
if (mLineageActionsSettings.isFlipToMuteEnabled() && !mIsEnabled) {
|
if (mMotoActionsSettings.isFlipToMuteEnabled() && !mIsEnabled) {
|
||||||
Log.d(TAG, "Enabling");
|
Log.d(TAG, "Enabling");
|
||||||
mSensorHelper.registerListener(mFlatDown, mFlatDownListener);
|
mSensorHelper.registerListener(mFlatDown, mFlatDownListener);
|
||||||
mSensorHelper.registerListener(mStow, mStowListener);
|
mSensorHelper.registerListener(mStow, mStowListener);
|
||||||
mContext.registerReceiver(mReceiver,
|
mContext.registerReceiver(mReceiver,
|
||||||
new IntentFilter(NotificationManager.ACTION_INTERRUPTION_FILTER_CHANGED));
|
new IntentFilter(NotificationManager.ACTION_INTERRUPTION_FILTER_CHANGED));
|
||||||
mIsEnabled = true;
|
mIsEnabled = true;
|
||||||
} else if (!mLineageActionsSettings.isFlipToMuteEnabled() && mIsEnabled) {
|
} else if (!mMotoActionsSettings.isFlipToMuteEnabled() && mIsEnabled) {
|
||||||
Log.d(TAG, "Disabling");
|
Log.d(TAG, "Disabling");
|
||||||
mSensorHelper.unregisterListener(mFlatDownListener);
|
mSensorHelper.unregisterListener(mFlatDownListener);
|
||||||
mSensorHelper.unregisterListener(mStowListener);
|
mSensorHelper.unregisterListener(mStowListener);
|
@ -26,13 +26,13 @@ import android.telecom.TelecomManager;
|
|||||||
import android.telephony.TelephonyManager;
|
import android.telephony.TelephonyManager;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
import org.lineageos.settings.device.LineageActionsSettings;
|
import org.lineageos.settings.device.MotoActionsSettings;
|
||||||
import org.lineageos.settings.device.SensorHelper;
|
import org.lineageos.settings.device.SensorHelper;
|
||||||
|
|
||||||
public class LiftToSilence extends PhoneStateListener implements SensorEventListener, UpdatedStateNotifier {
|
public class LiftToSilence extends PhoneStateListener implements SensorEventListener, UpdatedStateNotifier {
|
||||||
private static final String TAG = "LineageActions-LiftToSilence";
|
private static final String TAG = "MotoActions-LiftToSilence";
|
||||||
|
|
||||||
private final LineageActionsSettings mLineageActionsSettings;
|
private final MotoActionsSettings mMotoActionsSettings;
|
||||||
private final SensorHelper mSensorHelper;
|
private final SensorHelper mSensorHelper;
|
||||||
private final Sensor mFlatUpSensor;
|
private final Sensor mFlatUpSensor;
|
||||||
private final Sensor mStowSensor;
|
private final Sensor mStowSensor;
|
||||||
@ -44,9 +44,9 @@ public class LiftToSilence extends PhoneStateListener implements SensorEventList
|
|||||||
private boolean mIsStowed;
|
private boolean mIsStowed;
|
||||||
private boolean mLastFlatUp;
|
private boolean mLastFlatUp;
|
||||||
|
|
||||||
public LiftToSilence(LineageActionsSettings lineageActionsSettings, Context context,
|
public LiftToSilence(MotoActionsSettings MotoActionsSettings, Context context,
|
||||||
SensorHelper sensorHelper) {
|
SensorHelper sensorHelper) {
|
||||||
mLineageActionsSettings = lineageActionsSettings;
|
mMotoActionsSettings = MotoActionsSettings;
|
||||||
mSensorHelper = sensorHelper;
|
mSensorHelper = sensorHelper;
|
||||||
mFlatUpSensor = sensorHelper.getFlatUpSensor();
|
mFlatUpSensor = sensorHelper.getFlatUpSensor();
|
||||||
mStowSensor = sensorHelper.getStowSensor();
|
mStowSensor = sensorHelper.getStowSensor();
|
||||||
@ -56,7 +56,7 @@ public class LiftToSilence extends PhoneStateListener implements SensorEventList
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateState() {
|
public void updateState() {
|
||||||
if (mLineageActionsSettings.isLiftToSilenceEnabled()) {
|
if (mMotoActionsSettings.isLiftToSilenceEnabled()) {
|
||||||
mTelephonyManager.listen(this, LISTEN_CALL_STATE);
|
mTelephonyManager.listen(this, LISTEN_CALL_STATE);
|
||||||
} else {
|
} else {
|
||||||
mTelephonyManager.listen(this, 0);
|
mTelephonyManager.listen(this, 0);
|
@ -26,31 +26,31 @@ import android.telecom.TelecomManager;
|
|||||||
import android.telephony.TelephonyManager;
|
import android.telephony.TelephonyManager;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
import org.lineageos.settings.device.LineageActionsSettings;
|
import org.lineageos.settings.device.MotoActionsSettings;
|
||||||
import org.lineageos.settings.device.SensorHelper;
|
import org.lineageos.settings.device.SensorHelper;
|
||||||
|
|
||||||
import static android.telephony.TelephonyManager.*;
|
import static android.telephony.TelephonyManager.*;
|
||||||
|
|
||||||
public class ProximitySilencer extends PhoneStateListener implements SensorEventListener, UpdatedStateNotifier {
|
public class ProximitySilencer extends PhoneStateListener implements SensorEventListener, UpdatedStateNotifier {
|
||||||
private static final String TAG = "LineageActions-ProximitySilencer";
|
private static final String TAG = "MotoActions-ProximitySilencer";
|
||||||
|
|
||||||
private static final int SILENCE_DELAY_MS = 500;
|
private static final int SILENCE_DELAY_MS = 500;
|
||||||
|
|
||||||
private final TelecomManager mTelecomManager;
|
private final TelecomManager mTelecomManager;
|
||||||
private final TelephonyManager mTelephonyManager;
|
private final TelephonyManager mTelephonyManager;
|
||||||
private final LineageActionsSettings mLineageActionsSettings;
|
private final MotoActionsSettings mMotoActionsSettings;
|
||||||
private final SensorHelper mSensorHelper;
|
private final SensorHelper mSensorHelper;
|
||||||
private final Sensor mSensor;
|
private final Sensor mSensor;
|
||||||
private boolean mIsRinging;
|
private boolean mIsRinging;
|
||||||
private long mRingStartedMs;
|
private long mRingStartedMs;
|
||||||
private boolean mCoveredRinging;
|
private boolean mCoveredRinging;
|
||||||
|
|
||||||
public ProximitySilencer(LineageActionsSettings lineageActionsSettings, Context context,
|
public ProximitySilencer(MotoActionsSettings MotoActionsSettings, Context context,
|
||||||
SensorHelper sensorHelper) {
|
SensorHelper sensorHelper) {
|
||||||
mTelecomManager = (TelecomManager) context.getSystemService(Context.TELECOM_SERVICE);
|
mTelecomManager = (TelecomManager) context.getSystemService(Context.TELECOM_SERVICE);
|
||||||
mTelephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
|
mTelephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
|
||||||
|
|
||||||
mLineageActionsSettings = lineageActionsSettings;
|
mMotoActionsSettings = MotoActionsSettings;
|
||||||
mSensorHelper = sensorHelper;
|
mSensorHelper = sensorHelper;
|
||||||
mSensor = sensorHelper.getProximitySensor();
|
mSensor = sensorHelper.getProximitySensor();
|
||||||
mCoveredRinging = false;
|
mCoveredRinging = false;
|
||||||
@ -59,7 +59,7 @@ public class ProximitySilencer extends PhoneStateListener implements SensorEvent
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateState() {
|
public void updateState() {
|
||||||
if (mLineageActionsSettings.isIrSilencerEnabled()) {
|
if (mMotoActionsSettings.isIrSilencerEnabled()) {
|
||||||
mTelephonyManager.listen(this, LISTEN_CALL_STATE);
|
mTelephonyManager.listen(this, LISTEN_CALL_STATE);
|
||||||
} else {
|
} else {
|
||||||
mTelephonyManager.listen(this, 0);
|
mTelephonyManager.listen(this, 0);
|
@ -27,7 +27,7 @@ import android.util.Log;
|
|||||||
import org.lineageos.settings.device.SensorAction;
|
import org.lineageos.settings.device.SensorAction;
|
||||||
|
|
||||||
public class TorchAction implements SensorAction {
|
public class TorchAction implements SensorAction {
|
||||||
private static final String TAG = "LineageActions";
|
private static final String TAG = "MotoActions";
|
||||||
|
|
||||||
private static final int TURN_SCREEN_ON_WAKE_LOCK_MS = 500;
|
private static final int TURN_SCREEN_ON_WAKE_LOCK_MS = 500;
|
||||||
|
|
@ -24,7 +24,7 @@ import android.util.Log;
|
|||||||
import org.lineageos.settings.device.SensorAction;
|
import org.lineageos.settings.device.SensorAction;
|
||||||
|
|
||||||
public class DozePulseAction implements SensorAction, ScreenStateNotifier {
|
public class DozePulseAction implements SensorAction, ScreenStateNotifier {
|
||||||
private static final String TAG = "LineageActions";
|
private static final String TAG = "MotoActions";
|
||||||
|
|
||||||
private static final int DELAY_BETWEEN_DOZES_IN_MS = 1500;
|
private static final int DELAY_BETWEEN_DOZES_IN_MS = 1500;
|
||||||
|
|
@ -22,14 +22,14 @@ import android.hardware.SensorEvent;
|
|||||||
import android.hardware.SensorEventListener;
|
import android.hardware.SensorEventListener;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
import org.lineageos.settings.device.LineageActionsSettings;
|
import org.lineageos.settings.device.MotoActionsSettings;
|
||||||
import org.lineageos.settings.device.SensorAction;
|
import org.lineageos.settings.device.SensorAction;
|
||||||
import org.lineageos.settings.device.SensorHelper;
|
import org.lineageos.settings.device.SensorHelper;
|
||||||
|
|
||||||
public class FlatUpSensor implements ScreenStateNotifier {
|
public class FlatUpSensor implements ScreenStateNotifier {
|
||||||
private static final String TAG = "LineageActions-FlatUpSensor";
|
private static final String TAG = "MotoActions-FlatUpSensor";
|
||||||
|
|
||||||
private final LineageActionsSettings mLineageActionsSettings;
|
private final MotoActionsSettings mMotoActionsSettings;
|
||||||
private final SensorHelper mSensorHelper;
|
private final SensorHelper mSensorHelper;
|
||||||
private final SensorAction mSensorAction;
|
private final SensorAction mSensorAction;
|
||||||
private final Sensor mFlatUpSensor;
|
private final Sensor mFlatUpSensor;
|
||||||
@ -39,9 +39,9 @@ public class FlatUpSensor implements ScreenStateNotifier {
|
|||||||
private boolean mIsStowed;
|
private boolean mIsStowed;
|
||||||
private boolean mLastFlatUp;
|
private boolean mLastFlatUp;
|
||||||
|
|
||||||
public FlatUpSensor(LineageActionsSettings LineageActionsSettings, SensorHelper sensorHelper,
|
public FlatUpSensor(MotoActionsSettings MotoActionsSettings, SensorHelper sensorHelper,
|
||||||
SensorAction action) {
|
SensorAction action) {
|
||||||
mLineageActionsSettings = LineageActionsSettings;
|
mMotoActionsSettings = MotoActionsSettings;
|
||||||
mSensorHelper = sensorHelper;
|
mSensorHelper = sensorHelper;
|
||||||
mSensorAction = action;
|
mSensorAction = action;
|
||||||
|
|
||||||
@ -61,7 +61,7 @@ public class FlatUpSensor implements ScreenStateNotifier {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void screenTurnedOff() {
|
public void screenTurnedOff() {
|
||||||
if (mLineageActionsSettings.isPickUpEnabled() && !mEnabled) {
|
if (mMotoActionsSettings.isPickUpEnabled() && !mEnabled) {
|
||||||
Log.d(TAG, "Enabling");
|
Log.d(TAG, "Enabling");
|
||||||
mSensorHelper.registerListener(mFlatUpSensor, mFlatUpListener);
|
mSensorHelper.registerListener(mFlatUpSensor, mFlatUpListener);
|
||||||
mSensorHelper.registerListener(mStowSensor, mStowListener);
|
mSensorHelper.registerListener(mStowSensor, mStowListener);
|
@ -21,14 +21,14 @@ import android.hardware.SensorEvent;
|
|||||||
import android.hardware.SensorEventListener;
|
import android.hardware.SensorEventListener;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
import org.lineageos.settings.device.LineageActionsSettings;
|
import org.lineageos.settings.device.MotoActionsSettings;
|
||||||
import org.lineageos.settings.device.SensorAction;
|
import org.lineageos.settings.device.SensorAction;
|
||||||
import org.lineageos.settings.device.SensorHelper;
|
import org.lineageos.settings.device.SensorHelper;
|
||||||
|
|
||||||
public class GlanceSensor implements ScreenStateNotifier {
|
public class GlanceSensor implements ScreenStateNotifier {
|
||||||
private static final String TAG = "LineageActions-GlanceSensor";
|
private static final String TAG = "MotoActions-GlanceSensor";
|
||||||
|
|
||||||
private final LineageActionsSettings mLineageActionsSettings;
|
private final MotoActionsSettings mMotoActionsSettings;
|
||||||
private final SensorHelper mSensorHelper;
|
private final SensorHelper mSensorHelper;
|
||||||
private final SensorAction mSensorAction;
|
private final SensorAction mSensorAction;
|
||||||
|
|
||||||
@ -37,9 +37,9 @@ public class GlanceSensor implements ScreenStateNotifier {
|
|||||||
|
|
||||||
private boolean mEnabled;
|
private boolean mEnabled;
|
||||||
|
|
||||||
public GlanceSensor(LineageActionsSettings lineageActionsSettings, SensorHelper sensorHelper,
|
public GlanceSensor(MotoActionsSettings MotoActionsSettings, SensorHelper sensorHelper,
|
||||||
SensorAction action) {
|
SensorAction action) {
|
||||||
mLineageActionsSettings = lineageActionsSettings;
|
mMotoActionsSettings = MotoActionsSettings;
|
||||||
mSensorHelper = sensorHelper;
|
mSensorHelper = sensorHelper;
|
||||||
mSensorAction = action;
|
mSensorAction = action;
|
||||||
|
|
||||||
@ -59,7 +59,7 @@ public class GlanceSensor implements ScreenStateNotifier {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void screenTurnedOff() {
|
public void screenTurnedOff() {
|
||||||
if (mLineageActionsSettings.isPickUpEnabled() && !mEnabled) {
|
if (mMotoActionsSettings.isPickUpEnabled() && !mEnabled) {
|
||||||
Log.d(TAG, "Enabling");
|
Log.d(TAG, "Enabling");
|
||||||
mSensorHelper.registerListener(mSensor, mGlanceListener);
|
mSensorHelper.registerListener(mSensor, mGlanceListener);
|
||||||
mSensorHelper.registerListener(mSensor, mApproachGlanceListener);
|
mSensorHelper.registerListener(mSensor, mApproachGlanceListener);
|
@ -22,14 +22,14 @@ import android.hardware.SensorEvent;
|
|||||||
import android.hardware.SensorEventListener;
|
import android.hardware.SensorEventListener;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
import org.lineageos.settings.device.LineageActionsSettings;
|
import org.lineageos.settings.device.MotoActionsSettings;
|
||||||
import org.lineageos.settings.device.SensorAction;
|
import org.lineageos.settings.device.SensorAction;
|
||||||
import org.lineageos.settings.device.SensorHelper;
|
import org.lineageos.settings.device.SensorHelper;
|
||||||
|
|
||||||
public class ProximitySensor implements ScreenStateNotifier, SensorEventListener {
|
public class ProximitySensor implements ScreenStateNotifier, SensorEventListener {
|
||||||
private static final String TAG = "LineageActions-ProximitySensor";
|
private static final String TAG = "MotoActions-ProximitySensor";
|
||||||
|
|
||||||
private final LineageActionsSettings mLineageActionsSettings;
|
private final MotoActionsSettings mMotoActionsSettings;
|
||||||
private final SensorHelper mSensorHelper;
|
private final SensorHelper mSensorHelper;
|
||||||
private final SensorAction mSensorAction;
|
private final SensorAction mSensorAction;
|
||||||
private final Sensor mSensor;
|
private final Sensor mSensor;
|
||||||
@ -38,9 +38,9 @@ public class ProximitySensor implements ScreenStateNotifier, SensorEventListener
|
|||||||
|
|
||||||
private boolean mSawNear = false;
|
private boolean mSawNear = false;
|
||||||
|
|
||||||
public ProximitySensor(LineageActionsSettings lineageActionsSettings, SensorHelper sensorHelper,
|
public ProximitySensor(MotoActionsSettings MotoActionsSettings, SensorHelper sensorHelper,
|
||||||
SensorAction action) {
|
SensorAction action) {
|
||||||
mLineageActionsSettings = lineageActionsSettings;
|
mMotoActionsSettings = MotoActionsSettings;
|
||||||
mSensorHelper = sensorHelper;
|
mSensorHelper = sensorHelper;
|
||||||
mSensorAction = action;
|
mSensorAction = action;
|
||||||
|
|
||||||
@ -58,7 +58,7 @@ public class ProximitySensor implements ScreenStateNotifier, SensorEventListener
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void screenTurnedOff() {
|
public void screenTurnedOff() {
|
||||||
if (mLineageActionsSettings.isIrWakeupEnabled() && !mEnabled) {
|
if (mMotoActionsSettings.isIrWakeupEnabled() && !mEnabled) {
|
||||||
Log.d(TAG, "Enabling");
|
Log.d(TAG, "Enabling");
|
||||||
mSensorHelper.registerListener(mSensor, this);
|
mSensorHelper.registerListener(mSensor, this);
|
||||||
mEnabled = true;
|
mEnabled = true;
|
@ -24,15 +24,15 @@ import android.util.Log;
|
|||||||
|
|
||||||
import java.lang.System;
|
import java.lang.System;
|
||||||
|
|
||||||
import org.lineageos.settings.device.LineageActionsSettings;
|
import org.lineageos.settings.device.MotoActionsSettings;
|
||||||
import org.lineageos.settings.device.SensorAction;
|
import org.lineageos.settings.device.SensorAction;
|
||||||
import org.lineageos.settings.device.SensorHelper;
|
import org.lineageos.settings.device.SensorHelper;
|
||||||
|
|
||||||
public class StowSensor implements ScreenStateNotifier, SensorEventListener {
|
public class StowSensor implements ScreenStateNotifier, SensorEventListener {
|
||||||
private static final String TAG = "LineageActions-StowSensor";
|
private static final String TAG = "MotoActions-StowSensor";
|
||||||
private static final int IN_POCKET_MIN_TIME = 5000;
|
private static final int IN_POCKET_MIN_TIME = 5000;
|
||||||
|
|
||||||
private final LineageActionsSettings mLineageActionsSettings;
|
private final MotoActionsSettings mMotoActionsSettings;
|
||||||
private final SensorHelper mSensorHelper;
|
private final SensorHelper mSensorHelper;
|
||||||
private final SensorAction mSensorAction;
|
private final SensorAction mSensorAction;
|
||||||
private final Sensor mSensor;
|
private final Sensor mSensor;
|
||||||
@ -41,9 +41,9 @@ public class StowSensor implements ScreenStateNotifier, SensorEventListener {
|
|||||||
private boolean mLastStowed;
|
private boolean mLastStowed;
|
||||||
private long isStowedTime;
|
private long isStowedTime;
|
||||||
|
|
||||||
public StowSensor(LineageActionsSettings lineageActionsSettings, SensorHelper sensorHelper,
|
public StowSensor(MotoActionsSettings MotoActionsSettings, SensorHelper sensorHelper,
|
||||||
SensorAction action) {
|
SensorAction action) {
|
||||||
mLineageActionsSettings = lineageActionsSettings;
|
mMotoActionsSettings = MotoActionsSettings;
|
||||||
mSensorHelper = sensorHelper;
|
mSensorHelper = sensorHelper;
|
||||||
mSensorAction = action;
|
mSensorAction = action;
|
||||||
|
|
||||||
@ -61,8 +61,8 @@ public class StowSensor implements ScreenStateNotifier, SensorEventListener {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void screenTurnedOff() {
|
public void screenTurnedOff() {
|
||||||
if (!mLineageActionsSettings.isIrWakeupEnabled() &&
|
if (!mMotoActionsSettings.isIrWakeupEnabled() &&
|
||||||
mLineageActionsSettings.isPickUpEnabled() && !mEnabled) {
|
mMotoActionsSettings.isPickUpEnabled() && !mEnabled) {
|
||||||
Log.d(TAG, "Enabling");
|
Log.d(TAG, "Enabling");
|
||||||
mSensorHelper.registerListener(mSensor, this);
|
mSensorHelper.registerListener(mSensor, this);
|
||||||
mEnabled = true;
|
mEnabled = true;
|
Loading…
x
Reference in New Issue
Block a user