From 402db86450b9cf054525231ff123a432929e66aa Mon Sep 17 00:00:00 2001 From: giasen Date: Sat, 16 Mar 2024 11:30:48 +0100 Subject: [PATCH] sdm710-common: pocketmode: Drop pocketmode app - does nothing at all --- pocketmode/Android.mk | 16 ---- pocketmode/AndroidManifest.xml | 45 ---------- pocketmode/proguard.flags | 3 - .../pocketmode/BootCompletedReceiver.java | 36 -------- .../pocketmode/PocketModeService.java | 84 ------------------- .../lineageos/pocketmode/ProximitySensor.java | 77 ----------------- sdm710.mk | 4 - 7 files changed, 265 deletions(-) delete mode 100644 pocketmode/Android.mk delete mode 100644 pocketmode/AndroidManifest.xml delete mode 100644 pocketmode/proguard.flags delete mode 100644 pocketmode/src/org/lineageos/pocketmode/BootCompletedReceiver.java delete mode 100644 pocketmode/src/org/lineageos/pocketmode/PocketModeService.java delete mode 100644 pocketmode/src/org/lineageos/pocketmode/ProximitySensor.java diff --git a/pocketmode/Android.mk b/pocketmode/Android.mk deleted file mode 100644 index 3ff3004..0000000 --- a/pocketmode/Android.mk +++ /dev/null @@ -1,16 +0,0 @@ -LOCAL_PATH:= $(call my-dir) - -include $(CLEAR_VARS) - -LOCAL_MODULE_TAGS := optional - -LOCAL_SRC_FILES := $(call all-java-files-under, src) - -LOCAL_PACKAGE_NAME := LenovoPocketMode -LOCAL_CERTIFICATE := platform -LOCAL_PRIVATE_PLATFORM_APIS := true -LOCAL_PRIVILEGED_MODULE := true - -LOCAL_PROGUARD_FLAG_FILES := proguard.flags - -include $(BUILD_PACKAGE) diff --git a/pocketmode/AndroidManifest.xml b/pocketmode/AndroidManifest.xml deleted file mode 100644 index 1df9ca1..0000000 --- a/pocketmode/AndroidManifest.xml +++ /dev/null @@ -1,45 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - diff --git a/pocketmode/proguard.flags b/pocketmode/proguard.flags deleted file mode 100644 index 2087239..0000000 --- a/pocketmode/proguard.flags +++ /dev/null @@ -1,3 +0,0 @@ --keep class org.lineageos.pocketmode.* { - *; -} diff --git a/pocketmode/src/org/lineageos/pocketmode/BootCompletedReceiver.java b/pocketmode/src/org/lineageos/pocketmode/BootCompletedReceiver.java deleted file mode 100644 index 9d70d85..0000000 --- a/pocketmode/src/org/lineageos/pocketmode/BootCompletedReceiver.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (C) 2016 The CyanogenMod Project - * 2017 The LineageOS Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.lineageos.pocketmode; - -import android.content.BroadcastReceiver; -import android.content.Context; -import android.content.Intent; -import android.os.UserHandle; -import android.util.Log; - -public class BootCompletedReceiver extends BroadcastReceiver { - - private static final String TAG = "LenovoPocketMode"; - - @Override - public void onReceive(Context context, Intent intent) { - Log.d(TAG, "Starting"); - context.startServiceAsUser(new Intent(context, PocketModeService.class), - UserHandle.CURRENT); - } -} diff --git a/pocketmode/src/org/lineageos/pocketmode/PocketModeService.java b/pocketmode/src/org/lineageos/pocketmode/PocketModeService.java deleted file mode 100644 index cf75bfb..0000000 --- a/pocketmode/src/org/lineageos/pocketmode/PocketModeService.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright (C) 2016 The CyanogenMod Project - * 2017 The LineageOS Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.lineageos.pocketmode; - -import android.app.Service; -import android.content.BroadcastReceiver; -import android.content.Context; -import android.content.Intent; -import android.content.IntentFilter; -import android.os.IBinder; -import android.util.Log; - -public class PocketModeService extends Service { - private static final String TAG = "PocketModeService"; - private static final boolean DEBUG = false; - - private ProximitySensor mProximitySensor; - - @Override - public void onCreate() { - if (DEBUG) Log.d(TAG, "Creating service"); - mProximitySensor = new ProximitySensor(this); - - IntentFilter screenStateFilter = new IntentFilter(); - screenStateFilter.addAction(Intent.ACTION_SCREEN_OFF); - screenStateFilter.addAction(Intent.ACTION_USER_PRESENT); - registerReceiver(mScreenStateReceiver, screenStateFilter); - } - - @Override - public int onStartCommand(Intent intent, int flags, int startId) { - if (DEBUG) Log.d(TAG, "Starting service"); - return START_STICKY; - } - - @Override - public void onDestroy() { - if (DEBUG) Log.d(TAG, "Destroying service"); - this.unregisterReceiver(mScreenStateReceiver); - mProximitySensor.disable(); - super.onDestroy(); - } - - @Override - public IBinder onBind(Intent intent) { - return null; - } - - private void onDeviceUnlocked() { - if (DEBUG) Log.d(TAG, "Device unlocked"); - mProximitySensor.disable(); - } - - private void onDisplayOff() { - if (DEBUG) Log.d(TAG, "Display off"); - mProximitySensor.enable(); - } - - private BroadcastReceiver mScreenStateReceiver = new BroadcastReceiver() { - @Override - public void onReceive(Context context, Intent intent) { - if (intent.getAction().equals(Intent.ACTION_USER_PRESENT)) { - onDeviceUnlocked(); - } else if (intent.getAction().equals(Intent.ACTION_SCREEN_OFF)) { - onDisplayOff(); - } - } - }; -} diff --git a/pocketmode/src/org/lineageos/pocketmode/ProximitySensor.java b/pocketmode/src/org/lineageos/pocketmode/ProximitySensor.java deleted file mode 100644 index 51f9cf4..0000000 --- a/pocketmode/src/org/lineageos/pocketmode/ProximitySensor.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright (C) 2016 The CyanogenMod Project - * 2017-2019 The LineageOS Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.lineageos.pocketmode; - -import android.content.Context; -import android.hardware.Sensor; -import android.hardware.SensorEvent; -import android.hardware.SensorEventListener; -import android.hardware.SensorManager; -import android.os.FileUtils; -import android.util.Log; - -import java.io.IOException; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; -import java.util.concurrent.Future; - -public class ProximitySensor implements SensorEventListener { - private static final String TAG = "PocketModeProximity"; - private static final boolean DEBUG = false; - - private ExecutorService mExecutorService; - private Context mContext; - private Sensor mSensor; - private SensorManager mSensorManager; - - public ProximitySensor(Context context) { - mContext = context; - mSensorManager = mContext.getSystemService(SensorManager.class); - mSensor = mSensorManager.getDefaultSensor(Sensor.TYPE_PROXIMITY); - mExecutorService = Executors.newSingleThreadExecutor(); - } - - private Future submit(Runnable runnable) { - return mExecutorService.submit(runnable); - } - - @Override - public void onSensorChanged(SensorEvent event) { - /* Empty */ - } - - @Override - public void onAccuracyChanged(Sensor sensor, int accuracy) { - /* Empty */ - } - - protected void enable() { - if (DEBUG) Log.d(TAG, "Enabling"); - submit(() -> { - mSensorManager.registerListener(this, mSensor, - SensorManager.SENSOR_DELAY_NORMAL); - }); - } - - protected void disable() { - if (DEBUG) Log.d(TAG, "Disabling"); - submit(() -> { - mSensorManager.unregisterListener(this, mSensor); - }); - } -} diff --git a/sdm710.mk b/sdm710.mk index 31edc91..3aafab1 100644 --- a/sdm710.mk +++ b/sdm710.mk @@ -361,10 +361,6 @@ PRODUCT_PACKAGES += \ PRODUCT_PACKAGES += \ libqti-perfd-client -# PocketMode -PRODUCT_PACKAGES += \ - LenovoPocketMode - # Power PRODUCT_PACKAGES += \ android.hardware.power@1.2 \