diff --git a/DeviceExtras/AndroidManifest.xml b/DeviceExtras/AndroidManifest.xml index 7900939..a148a7e 100644 --- a/DeviceExtras/AndroidManifest.xml +++ b/DeviceExtras/AndroidManifest.xml @@ -73,18 +73,6 @@ android:resource="@string/device_summary" /> - - - - - - - - - - diff --git a/DeviceExtras/res/values/strings.xml b/DeviceExtras/res/values/strings.xml index 1c1b961..7a544c9 100644 --- a/DeviceExtras/res/values/strings.xml +++ b/DeviceExtras/res/values/strings.xml @@ -20,11 +20,6 @@ Device Extras Adjust device specific settings - - Power - Wireless powershare - Enable reverse wireless charging - USB USB-OTG diff --git a/DeviceExtras/res/xml/main.xml b/DeviceExtras/res/xml/main.xml index 3d8a387..fe840bd 100644 --- a/DeviceExtras/res/xml/main.xml +++ b/DeviceExtras/res/xml/main.xml @@ -19,17 +19,6 @@ xmlns:settings="http://schemas.android.com/apk/res/org.neoteric.device.DeviceExtras" android.title="@string/device_title"> - - - - - @@ -40,4 +29,5 @@ android:title="@string/otg_mode_title" android:summary="@string/otg_mode_summary" /> + diff --git a/DeviceExtras/src/org/neoteric/device/DeviceExtras/DeviceExtras.java b/DeviceExtras/src/org/neoteric/device/DeviceExtras/DeviceExtras.java index b6071c5..fc2ee2b 100644 --- a/DeviceExtras/src/org/neoteric/device/DeviceExtras/DeviceExtras.java +++ b/DeviceExtras/src/org/neoteric/device/DeviceExtras/DeviceExtras.java @@ -34,10 +34,8 @@ import org.neoteric.device.DeviceExtras.FileUtils; import org.neoteric.device.DeviceExtras.R; public class DeviceExtras extends PreferenceFragment { - public static final String KEY_POWERSHARE_SWITCH = "powershare"; public static final String KEY_OTG_SWITCH = "otg"; - private static TwoStatePreference mPowerShareModeSwitch; private static TwoStatePreference mOTGModeSwitch; @Override @@ -45,13 +43,6 @@ public class DeviceExtras extends PreferenceFragment { final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this.getContext()); addPreferencesFromResource(R.xml.main); getActivity().getActionBar().setDisplayHomeAsUpEnabled(true); - - // PowerShare - mPowerShareModeSwitch = (TwoStatePreference) findPreference(KEY_POWERSHARE_SWITCH); - if (PowerShareModeSwitch.isSupported()) { - mPowerShareModeSwitch.setChecked(PowerShareModeSwitch.isCurrentlyEnabled()); - mPowerShareModeSwitch.setOnPreferenceChangeListener(new PowerShareModeSwitch()); - } // OTG mOTGModeSwitch = (TwoStatePreference) findPreference(KEY_OTG_SWITCH); diff --git a/DeviceExtras/src/org/neoteric/device/DeviceExtras/ModeSwitch/PowerShareModeSwitch.java b/DeviceExtras/src/org/neoteric/device/DeviceExtras/ModeSwitch/PowerShareModeSwitch.java deleted file mode 100644 index eca1447..0000000 --- a/DeviceExtras/src/org/neoteric/device/DeviceExtras/ModeSwitch/PowerShareModeSwitch.java +++ /dev/null @@ -1,44 +0,0 @@ -/* -* Copyright (C) 2016 The OmniROM Project -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 2 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -* -*/ -package org.neoteric.device.DeviceExtras; - -import android.content.Context; -import androidx.preference.Preference; -import androidx.preference.Preference.OnPreferenceChangeListener; - -import org.neoteric.device.DeviceExtras.FileUtils; - -public class PowerShareModeSwitch implements OnPreferenceChangeListener { - - public static final String FILE = "/sys/class/qcom-battery/wireless_boost_en"; - - public static boolean isSupported() { - return FileUtils.fileWritable(FILE); - } - - public static boolean isCurrentlyEnabled() { - return (isSupported() && FileUtils.getFileValueAsBoolean(FILE, false)); - } - - @Override - public boolean onPreferenceChange(Preference preference, Object newValue) { - Boolean enabled = (Boolean) newValue; - FileUtils.writeValue(FILE, enabled ? "1" : "0"); - return true; - } -} diff --git a/DeviceExtras/src/org/neoteric/device/DeviceExtras/Startup.java b/DeviceExtras/src/org/neoteric/device/DeviceExtras/Startup.java index ecdd5d2..31f4f33 100644 --- a/DeviceExtras/src/org/neoteric/device/DeviceExtras/Startup.java +++ b/DeviceExtras/src/org/neoteric/device/DeviceExtras/Startup.java @@ -30,10 +30,6 @@ public class Startup extends BroadcastReceiver { public void onReceive(final Context context, final Intent bootintent) { boolean enabled = false; SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(context); - enabled = sharedPrefs.getBoolean(DeviceExtras.KEY_POWERSHARE_SWITCH, false); - if (PowerShareModeSwitch.isSupported() && enabled) { - restore(PowerShareModeSwitch.FILE, enabled); - } enabled = sharedPrefs.getBoolean(DeviceExtras.KEY_OTG_SWITCH, false); if (OTGModeSwitch.isSupported() && enabled) { restore(OTGModeSwitch.FILE, enabled); diff --git a/DeviceExtras/src/org/neoteric/device/DeviceExtras/Tiles/PowerShareTileService.java b/DeviceExtras/src/org/neoteric/device/DeviceExtras/Tiles/PowerShareTileService.java deleted file mode 100644 index 52a4d89..0000000 --- a/DeviceExtras/src/org/neoteric/device/DeviceExtras/Tiles/PowerShareTileService.java +++ /dev/null @@ -1,62 +0,0 @@ -/* -* Copyright (C) 2018 The OmniROM Project -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 2 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -* -*/ -package org.neoteric.device.DeviceExtras; - -import android.content.SharedPreferences; -import android.service.quicksettings.Tile; -import android.service.quicksettings.TileService; -import androidx.preference.PreferenceManager; - -import org.neoteric.device.DeviceExtras.DeviceExtras; - -public class PowerShareTileService extends TileService { - @Override - public void onStartListening() { - super.onStartListening(); - updateState(); - } - - private void updateState() { - Tile mTile = getQsTile(); - if (mTile != null) { - boolean enabled = getEnabled(); - mTile.setSubtitle(enabled ? - getString(R.string.accessibility_quick_settings_on) : - getString(R.string.accessibility_quick_settings_off)); - mTile.setState(enabled ? Tile.STATE_ACTIVE : Tile.STATE_INACTIVE); - mTile.updateTile(); - } - } - - @Override - public void onClick() { - super.onClick(); - setEnabled(!getEnabled()); - updateState(); - } - - private boolean getEnabled() { - return PreferenceManager.getDefaultSharedPreferences(this).getBoolean(DeviceExtras.KEY_POWERSHARE_SWITCH, false); - } - - private void setEnabled(boolean enabled) { - FileUtils.writeValue(PowerShareModeSwitch.FILE, enabled ? "1" : "0"); - SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(this); - sharedPrefs.edit().putBoolean(DeviceExtras.KEY_POWERSHARE_SWITCH, enabled).apply(); - } -}