aboutsummaryrefslogtreecommitdiff
path: root/pocketmode
diff options
context:
space:
mode:
authorOrdenKrieger <OrdenKriegerEDR@googlemail.com>2017-01-10 23:28:05 +0100
committerdavidevinavil <davidevinavil@gmail.com>2017-01-14 15:50:26 +0100
commit6fe46d118dacf3ca734f0a792713a36f33cb921b (patch)
tree63e2c3007ce66d3d43d66ec43a1b8b6e7f26a42c /pocketmode
parent51fe6eb1975b0978ebe8eaa9cf8a7e4d01d2525b (diff)
z_2plus: Initial cleanup
*Lets start
Diffstat (limited to 'pocketmode')
-rw-r--r--pocketmode/Android.mk19
-rw-r--r--pocketmode/AndroidManifest.xml41
-rw-r--r--pocketmode/proguard.flags3
-rw-r--r--pocketmode/src/com/cyanogenmod/pocketmode/BootCompletedReceiver.java33
-rw-r--r--pocketmode/src/com/cyanogenmod/pocketmode/PocketModeService.java82
-rw-r--r--pocketmode/src/com/cyanogenmod/pocketmode/ProximitySensor.java68
6 files changed, 0 insertions, 246 deletions
diff --git a/pocketmode/Android.mk b/pocketmode/Android.mk
deleted file mode 100644
index 1addd86..0000000
--- a/pocketmode/Android.mk
+++ /dev/null
@@ -1,19 +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 := ZukPocketMode
-LOCAL_CERTIFICATE := platform
-LOCAL_PRIVILEGED_MODULE := true
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
- org.cyanogenmod.platform
-
-LOCAL_PROGUARD_FLAG_FILES := proguard.flags
-
-include $(BUILD_PACKAGE)
-
-include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/pocketmode/AndroidManifest.xml b/pocketmode/AndroidManifest.xml
deleted file mode 100644
index a478254..0000000
--- a/pocketmode/AndroidManifest.xml
+++ /dev/null
@@ -1,41 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="com.cyanogenmod.pocketmode"
- android:versionCode="1"
- android:versionName="1.0"
- android:sharedUserId="android.uid.system">
-
- <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
-
- <uses-sdk
- android:minSdkVersion="21"
- android:targetSdkVersion="21"/>
-
- <application
- android:label="ZukPocketMode"
- android:persistent="true">
-
- <receiver android:name="com.cyanogenmod.pocketmode.BootCompletedReceiver">
- <intent-filter>
- <action android:name="android.intent.action.BOOT_COMPLETED" />
- <category android:name="android.intent.category.DEFAULT" />
- </intent-filter>
- </receiver>
-
- <service android:name="com.cyanogenmod.pocketmode.PocketModeService"
- android:permission="ZukPocketModeService">
- </service>
-
- <activity android:name="PocketMode"
- android:label="PocketMode"
- android:excludeFromRecents="true"
- android:launchMode="singleInstance"
- android:screenOrientation="portrait"
- android:windowAnimationStyle="@null">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- </intent-filter>
- </activity>
-
- </application>
-</manifest>
diff --git a/pocketmode/proguard.flags b/pocketmode/proguard.flags
deleted file mode 100644
index c3e1ef7..0000000
--- a/pocketmode/proguard.flags
+++ /dev/null
@@ -1,3 +0,0 @@
--keep class com.cyanogenmod.pocketmode.* {
- *;
-}
diff --git a/pocketmode/src/com/cyanogenmod/pocketmode/BootCompletedReceiver.java b/pocketmode/src/com/cyanogenmod/pocketmode/BootCompletedReceiver.java
deleted file mode 100644
index 04a5e72..0000000
--- a/pocketmode/src/com/cyanogenmod/pocketmode/BootCompletedReceiver.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright (c) 2016 The CyanogenMod 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 com.cyanogenmod.pocketmode;
-
-import android.content.BroadcastReceiver;
-import android.content.Context;
-import android.content.Intent;
-import android.util.Log;
-
-public class BootCompletedReceiver extends BroadcastReceiver {
-
- private static final String TAG = "ZukPocketMode";
-
- @Override
- public void onReceive(final Context context, Intent intent) {
- Log.d(TAG, "Starting");
- context.startService(new Intent(context, PocketModeService.class));
- }
-}
diff --git a/pocketmode/src/com/cyanogenmod/pocketmode/PocketModeService.java b/pocketmode/src/com/cyanogenmod/pocketmode/PocketModeService.java
deleted file mode 100644
index a5025ee..0000000
--- a/pocketmode/src/com/cyanogenmod/pocketmode/PocketModeService.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Copyright (c) 2016 The CyanogenMod 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 com.cyanogenmod.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(Intent.ACTION_SCREEN_ON);
- screenStateFilter.addAction(Intent.ACTION_SCREEN_OFF);
- 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");
- super.onDestroy();
- this.unregisterReceiver(mScreenStateReceiver);
- mProximitySensor.disable();
- }
-
- @Override
- public IBinder onBind(Intent intent) {
- return null;
- }
-
- private void onDisplayOn() {
- if (DEBUG) Log.d(TAG, "Display on");
- 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_SCREEN_ON)) {
- onDisplayOn();
- } else if (intent.getAction().equals(Intent.ACTION_SCREEN_OFF)) {
- onDisplayOff();
- }
- }
- };
-}
diff --git a/pocketmode/src/com/cyanogenmod/pocketmode/ProximitySensor.java b/pocketmode/src/com/cyanogenmod/pocketmode/ProximitySensor.java
deleted file mode 100644
index 9ff1f06..0000000
--- a/pocketmode/src/com/cyanogenmod/pocketmode/ProximitySensor.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Copyright (c) 2016 The CyanogenMod 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 com.cyanogenmod.pocketmode;
-
-import android.content.Context;
-import android.hardware.Sensor;
-import android.hardware.SensorEvent;
-import android.hardware.SensorEventListener;
-import android.hardware.SensorManager;
-import android.util.Log;
-import org.cyanogenmod.internal.util.FileUtils;
-
-public class ProximitySensor implements SensorEventListener {
-
- private static final boolean DEBUG = false;
- private static final String TAG = "PocketModeProximity";
-
- private static final String FPC_FILE = "/sys/devices/soc/soc:fpc_fpc1020/proximity_state";
-
- private SensorManager mSensorManager;
- private Sensor mSensor;
- private Context mContext;
-
- public ProximitySensor(Context context) {
- mContext = context;
- mSensorManager = (SensorManager)
- mContext.getSystemService(Context.SENSOR_SERVICE);
- mSensor = mSensorManager.getDefaultSensor(Sensor.TYPE_PROXIMITY);
- }
-
- @Override
- public void onSensorChanged(SensorEvent event) {
- boolean isNear = event.values[0] < mSensor.getMaximumRange();
- if (FileUtils.isFileWritable(FPC_FILE)) {
- FileUtils.writeLine(FPC_FILE, isNear ? "1" : "0");
- }
- }
-
- @Override
- public void onAccuracyChanged(Sensor sensor, int accuracy) {
- /* Empty */
- }
-
- protected void enable() {
- if (DEBUG) Log.d(TAG, "Enabling");
- mSensorManager.registerListener(this, mSensor,
- SensorManager.SENSOR_DELAY_NORMAL);
- }
-
- protected void disable() {
- if (DEBUG) Log.d(TAG, "Disabling");
- mSensorManager.unregisterListener(this, mSensor);
- }
-}