Skip to content

Settings: Add pocket lock toggle #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: eleven
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
.idea/
*.iml
Explosives/*
AboutPhone/*
1 change: 0 additions & 1 deletion AboutPhone

This file was deleted.

6 changes: 6 additions & 0 deletions AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,12 @@
</intent-filter>
</receiver>

<receiver android:name=".SettingsOnBoot">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED"/>
</intent-filter>
</receiver>

<activity android:name=".SubSettings"/>

<activity android:name=".Settings$CreateShortcutActivity"
Expand Down
2 changes: 1 addition & 1 deletion proguard-core.flags
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# Explosives
-keep class com.blaster.settings.**
-keep class com.blaster.settings.**
22 changes: 22 additions & 0 deletions res/drawable/ic_traffic.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<!--
Copyright (C) 2014 The Android Open Source 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.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:height="24dp"
android:width="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?android:attr/colorControlNormal">
<path
android:fillColor="@android:color/black"
android:pathData="M17.3,18C19,16.5 20,14.4 20,12A8,8 0 0,0 12,4A8,8 0 0,0 4,12C4,14.4 5,16.5 6.7,18C8.2,16.7 10,16 12,16C14,16 15.9,16.7 17.3,18M12,2A10,10 0 0,1 22,12A10,10 0 0,1 12,22A10,10 0 0,1 2,12A10,10 0 0,1 12,2M7,9A1,1 0 0,1 8,10A1,1 0 0,1 7,11A1,1 0 0,1 6,10A1,1 0 0,1 7,9M10,6A1,1 0 0,1 11,7A1,1 0 0,1 10,8A1,1 0 0,1 9,7A1,1 0 0,1 10,6M17,9A1,1 0 0,1 18,10A1,1 0 0,1 17,11A1,1 0 0,1 16,10A1,1 0 0,1 17,9M14.4,6.1C14.9,6.3 15.1,6.9 15,7.4L13.6,10.8C13.8,11.1 14,11.5 14,12A2,2 0 0,1 12,14A2,2 0 0,1 10,12C10,11 10.7,10.1 11.7,10L13.1,6.7C13.3,6.1 13.9,5.9 14.4,6.1Z" />
</vector>
6 changes: 6 additions & 0 deletions res/values-ru/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5144,6 +5144,12 @@
<string name="keywords_media_controls" msgid="8345490568291778638">"Медиа"</string>
<string name="connected_device_see_all_summary" msgid="2056010318537268108">"Будет включен модуль Bluetooth"</string>
<string name="aware_summary_when_bedtime_on" msgid="2063856008597376344">"Недоступно в ночном режиме"</string>
<string name="active_sim_tittle">"Активные SIM-карты"</string>
<string name="active_sim_summary">"Выберите SIM-карты, которые будут включены"</string>
<string name="active_sim_both">"Обе активны"</string>
<string name="active_sim_one">"Только первая"</string>
<string name="active_sim_two">"Только вторая"</string>
<string name="active_sim_none">"Обе отключены"</string>
<string name="bluetooth_message_access_notification_content" msgid="2986108412562309009">"Неизвестное устройство запрашивает доступ к вашим сообщениям. Нажмите, чтобы узнать больше."</string>
<string name="bluetooth_message_access_dialog_title" msgid="9009836130395061579">"Предоставить доступ к сообщениям?"</string>
<string name="bluetooth_message_access_dialog_content" msgid="2304761898608701739">"Неизвестное устройство Bluetooth (<xliff:g id="DEVICE_NAME_0">%1$s</xliff:g>) запрашивает доступ к вашим сообщениям.\n\nЭто ваше первое подключение к устройству \"<xliff:g id="DEVICE_NAME_1">%2$s</xliff:g>\"."</string>
Expand Down
14 changes: 14 additions & 0 deletions res/values/arrays.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1502,4 +1502,18 @@
<item>@string/rtt_settings_always_visible</item>
</string-array>

<string-array name="active_sim_entries" translatable="false">
<item>@string/active_sim_both</item>
<item>@string/active_sim_one</item>
<item>@string/active_sim_two</item>
<item>@string/active_sim_none</item>
</string-array>

<string-array name="active_sim_values" translatable="false">
<item>0</item>
<item>1</item>
<item>2</item>
<item>3</item>
</string-array>

</resources>
13 changes: 13 additions & 0 deletions res/values/custom_arrays.xml
Original file line number Diff line number Diff line change
Expand Up @@ -83,4 +83,17 @@
<item>5</item>
</string-array>

<!-- Network Traffic Type -->
<string-array name="show_network_traffic_type_entries" translatable="false">
<item>@string/show_network_traffic_up</item>
<item>@string/show_network_traffic_down</item>
<item>@string/show_network_traffic_all</item>
</string-array>

<string-array name="show_network_traffic_type_values" translatable="false">
<item>1</item>
<item>2</item>
<item>0</item>
</string-array>

</resources>
19 changes: 19 additions & 0 deletions res/values/custom_strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -247,4 +247,23 @@
<string name="show_permissions_hub">Show permissions hub</string>
<string name="show_permissions_hub_summary">Display privacy indicators in QS</string>

<!-- Pocket mode -->
<string name="proximity_wake_title">Prevent accidental wake-up</string>
<string name="proximity_wake_summary">Check the proximity sensor prior to waking up screen</string>

<!-- Hotspot client manager -->
<string name="wifi_tether_client_list_title">Client List</string>
<string name="wifi_tether_client_list_summary">Manage clients connected to hotspot</string>

<!-- Network traffic -->
<string name="traffic_title">Traffic indicators</string>
<string name="traffic_summary">Enable or disable network speed indicators</string>
<string name="network_traffic_title">Network traffic</string>
<string name="network_traffic_type">Select net activity type</string>
<string name="show_network_traffic_up">Uplink</string>
<string name="show_network_traffic_down">Downlink</string>
<string name="show_network_traffic_all">Uplink and Downlink</string>
<string name="network_traffic_state_title">Show net activity in statusbar</string>
<string name="network_traffic_autohide_threshold_title">Net activity autohide threshold (KB/s)</string>

</resources>
8 changes: 8 additions & 0 deletions res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12201,6 +12201,14 @@
<!-- Screenshot sound -->
<string name="screenshot_sound_title">Screenshot sound</string>

<string name="active_sim_tittle">Active SIM cards</string>
<string name="active_sim_summary">Select SIM cards to be included</string>

<string name="active_sim_both">Both SIM cards</string>
<string name="active_sim_one">Only the first</string>
<string name="active_sim_two">Only the second</string>
<string name="active_sim_none">Both disabled</string>

<!-- Bluetooth message permission alert for notification content [CHAR LIMIT=none] -->
<string name="bluetooth_message_access_notification_content">A device wants to access your messages. Tap for details.</string>
<!-- Bluetooth message permission alert for dialog title [CHAR LIMIT=none] -->
Expand Down
5 changes: 5 additions & 0 deletions res/xml/display_settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,11 @@
android:title="@string/enable_blurs_on_windows_title"
settings:iconSpaceReserved="false"
android:summary="@string/enable_blurs_on_windows_summary" />

<SwitchPreference
android:key="pocket_judge"
android:title="@string/proximity_wake_title"
android:summary="@string/proximity_wake_summary" />

<ListPreference
android:key="theme"
Expand Down
16 changes: 16 additions & 0 deletions res/xml/network_and_internet.xml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,14 @@
settings:userRestriction="no_config_mobile_networks"
settings:useAdminDisabledSummary="true" />

<Preference
android:key="traffic"
android:fragment="com.android.settings.custom.Traffic"
android:order="-10"
android:icon="@drawable/ic_traffic"
android:title="@string/traffic_title"
android:summary="@string/traffic_summary" />

<com.android.settingslib.RestrictedSwitchPreference
android:key="airplane_mode"
android:title="@string/airplane_mode"
Expand Down Expand Up @@ -120,6 +128,14 @@
android:positiveButtonText="@string/save"
android:negativeButtonText="@android:string/cancel"/>

<ListPreference
android:key="active_sim_settings"
android:title="@string/active_sim_tittle"
android:dialogTitle="@string/active_sim_summary"
android:order="22"
android:entries="@array/active_sim_entries"
android:entryValues="@array/active_sim_values" />

<Preference
android:fragment="com.android.settings.network.AdaptiveConnectivitySettings"
android:key="adaptive_connectivity"
Expand Down
18 changes: 8 additions & 10 deletions res/xml/top_level_settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -152,20 +152,18 @@
android:layout="@layout/op_home_preference_card_top"
android:icon="@drawable/op_ic_homepage_system_dashboard_settings"
android:order="10"
android:fragment="com.android.settings.system.SystemDashboardFragment"/>
android:fragment="com.android.settings.system.SystemDashboardFragment"/>

<Preference
android:key="top_level_about"
android:key="top_level_about_device"
android:title="@string/about_settings"
android:summary="About Phone"
android:layout="@layout/op_home_preference_card_bottom"
android:summary="@string/summary_placeholder"
android:icon="@drawable/op_ic_homepage_about_settings"
android:order="20">
<intent
android:action="android.intent.action.MAIN"
android:targetPackage="com.blaster.aboutphone"
android:targetClass="com.blaster.aboutphone.AboutRedesigned" />
</Preference>
android:layout="@layout/op_home_preference_card_bottom"
android:order="20"
android:fragment="com.android.settings.deviceinfo.aboutphone.MyDeviceInfoFragment"
settings:controller="com.android.settings.deviceinfo.aboutphone.TopLevelAboutDevicePreferenceController"/>

<Preference
android:key="top_level_support"
android:summary="@string/support_summary"
Expand Down
13 changes: 5 additions & 8 deletions res/xml/top_level_settings_no_cards.xml
Original file line number Diff line number Diff line change
Expand Up @@ -154,17 +154,14 @@
android:fragment="com.android.settings.system.SystemDashboardFragment"/>

<Preference
android:key="top_level_about"
android:key="top_level_about_device"
android:title="@string/about_settings"
android:summary="@string/summary_placeholder"
android:layout="@layout/preference_with_icon"
android:icon="@drawable/op_ic_homepage_about_settings"
android:order="20">
<intent
android:action="android.intent.action.MAIN"
android:targetPackage="com.blaster.aboutphone"
android:targetClass="com.blaster.aboutphone.AboutRedesigned" />
</Preference>
android:layout="@layout/preference_with_icon"
android:order="20"
android:fragment="com.android.settings.deviceinfo.aboutphone.MyDeviceInfoFragment"
settings:controller="com.android.settings.deviceinfo.aboutphone.TopLevelAboutDevicePreferenceController"/>

<Preference
android:key="top_level_support"
Expand Down
11 changes: 4 additions & 7 deletions res/xml/top_level_settings_no_icons.xml
Original file line number Diff line number Diff line change
Expand Up @@ -140,16 +140,13 @@
android:fragment="com.android.settings.system.SystemDashboardFragment"/>

<Preference
android:key="top_level_about"
android:key="top_level_about_device"
android:title="@string/about_settings"
android:summary="@string/summary_placeholder"
android:icon="@drawable/op_ic_homepage_about_settings"
android:order="20">
<intent
android:action="android.intent.action.MAIN"
android:targetPackage="com.blaster.aboutphone"
android:targetClass="com.blaster.aboutphone.AboutRedesigned" />
</Preference>
android:order="20"
android:fragment="com.android.settings.deviceinfo.aboutphone.MyDeviceInfoFragment"
settings:controller="com.android.settings.deviceinfo.aboutphone.TopLevelAboutDevicePreferenceController"/>

<Preference
android:key="top_level_support"
Expand Down
31 changes: 31 additions & 0 deletions res/xml/traffic.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Copyright (C) 2014-2016 AospExtended ROM 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.
-->

<PreferenceScreen
android:title="@string/network_traffic_title"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:settings="http://schemas.android.com/apk/res/com.android.settings">

<com.android.settings.custom.preference.SystemSettingSwitchPreference
android:key="network_traffic_state"
android:title="@string/network_traffic_state_title"
android:defaultValue="false" />

<com.android.settings.custom.preference.CustomSystemSeekBarPreference
android:key="network_traffic_autohide_threshold"
android:title="@string/network_traffic_autohide_threshold_title"
android:max="10"
settings:min="0"
settings:units="" />

</PreferenceScreen>
10 changes: 10 additions & 0 deletions res/xml/wifi_tether_settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,14 @@
android:key="wifi_tether_auto_turn_off"
android:title="@string/wifi_hotspot_auto_off_title"
android:summary="@string/wifi_hotspot_auto_off_summary"/>

<PreferenceScreen
android:key="wifi_tether_client_list"
android:title="@string/wifi_tether_client_list_title"
android:summary="@string/wifi_tether_client_list_summary">
<intent android:action="android.intent.action.MAIN"
android:targetPackage="org.exthmui.softap"
android:targetClass="org.exthmui.softap.ClientListActivity" />
</PreferenceScreen>

</PreferenceScreen>
2 changes: 2 additions & 0 deletions src/com/android/settings/DisplaySettings.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import com.android.settings.display.BrightnessLevelPreferenceController;
import com.android.settings.display.CameraGesturePreferenceController;
import com.android.settings.display.LiftToWakePreferenceController;
import com.android.settings.display.PocketJudgePreferenceController;
import com.android.settings.display.NightDisplayPreferenceController;
import com.android.settings.display.NightModePreferenceController;
import com.android.settings.display.ScreenSaverPreferenceController;
Expand Down Expand Up @@ -120,6 +121,7 @@ private static List<AbstractPreferenceController> buildPreferenceControllers(
final List<AbstractPreferenceController> controllers = new ArrayList<>();
controllers.add(new CameraGesturePreferenceController(context));
controllers.add(new LiftToWakePreferenceController(context));
controllers.add(new PocketJudgePreferenceController(context));
controllers.add(new NightDisplayPreferenceController(context));
controllers.add(new NightModePreferenceController(context));
controllers.add(new ScreenSaverPreferenceController(context));
Expand Down
1 change: 0 additions & 1 deletion src/com/android/settings/Settings.java
Original file line number Diff line number Diff line change
Expand Up @@ -248,5 +248,4 @@ public static class MediaControlsSettingsActivity extends SettingsActivity {}
public static class ExplosivesActivity extends SettingsActivity { /* empty */ }

public static class GamingModeActivity extends SettingsActivity {}

}
65 changes: 65 additions & 0 deletions src/com/android/settings/SettingsOnBoot.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
/*
* Copyright (C) 2021 The Android Open Source 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.android.settings;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.os.Build;
import android.os.SystemProperties;
import android.telephony.TelephonyManager;
import android.util.Log;

public class SettingsOnBoot extends BroadcastReceiver {
private static final String ACTIVE_SIM_MODE_PROPERTY = "persist.sim.activesim";

@Override
public void onReceive(Context context, Intent broadcast) {
final TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
activeSimSettingSetup(context, tm);
}

private void activeSimSettingSetup(Context context, TelephonyManager tm) {
if (tm == null) {
return;
}
final String strValue = SystemProperties.get(ACTIVE_SIM_MODE_PROPERTY);
final int intValue = Integer.valueOf(strValue);
switch (intValue) {
case 0:
tm.setSimPowerStateForSlot(0, 1);
tm.setSimPowerStateForSlot(1, 1);
break;
case 1:
tm.setSimPowerStateForSlot(0, 1);
tm.setSimPowerStateForSlot(1, 0);
break;
case 2:
tm.setSimPowerStateForSlot(0, 0);
tm.setSimPowerStateForSlot(1, 1);
break;
case 3:
tm.setSimPowerStateForSlot(0, 0);
tm.setSimPowerStateForSlot(1, 0);
break;
default:
tm.setSimPowerStateForSlot(0, 1);
tm.setSimPowerStateForSlot(1, 1);
break;
}
}
}
2 changes: 1 addition & 1 deletion src/com/android/settings/core/gateway/SettingsGateway.java
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ public class SettingsGateway {
InteractAcrossProfilesDetails.class.getName(),
MediaControlsSettings.class.getName(),
Explosives.class.getName(),
GamingMode.class.getName(),
GamingMode.class.getName()
};

public static final String[] SETTINGS_FOR_RESTRICTED = {
Expand Down
Loading