Cherish:incall vibration options [3/3]

*allow setting vibration when call is connected
*allow setting vibration when call is disconnected
*allow setting vibration for call waiting
*this works with google and aosp dialer :)

Change-Id: Id1a431124174571f8d0091825af2418971cfe35d
Signed-off-by: AmolAmrit <amol.amrit03@outlook.com>
Signed-off-by: SagarMakhar <sagarmakhar@gmail.com>
Signed-off-by: Hưng Phan <phandinhhungvp2001@gmail.com>
This commit is contained in:
beanstown106
2021-10-25 17:57:04 +07:00
committed by Hưng Phan
parent eb7d3bf5c1
commit 578c823a31
4 changed files with 34 additions and 5 deletions

View File

@@ -262,4 +262,9 @@
<string name="clock_date_left">Left of time</string>
<string name="clock_date_position">Date position</string>
<!-- Incall vibrate options -->
<string name="incall_vibration_category">In-call vibration options</string>
<string name="incall_vibrate_connect_title">Vibrate on connect</string>
<string name="incall_vibrate_call_wait_title">Vibrate on call waiting</string>
<string name="incall_vibrate_disconnect_title">Vibrate on disconnect</string>
</resources>

View File

@@ -18,7 +18,7 @@
android:title="@string/notifications_title"
xmlns:settings="http://schemas.android.com/apk/res/com.android.settings">
<!-- <PreferenceCategory
<PreferenceCategory
android:key="incall_vib_options"
android:title="@string/incall_vibration_category">
@@ -40,7 +40,7 @@
android:title="@string/incall_vibrate_disconnect_title"
android:defaultValue="true" />
</PreferenceCategory> -->
</PreferenceCategory>
<PreferenceCategory
android:key="headsup_notifications_category"

View File

@@ -31,6 +31,7 @@ import com.cherish.settings.preferences.SystemSettingListPreference;
import com.cherish.settings.preferences.SystemSettingSwitchPreference;
import net.margaritov.preference.colorpicker.ColorPickerPreference;
import com.android.internal.util.cherish.CherishUtils;
import com.cherish.settings.preferences.Utils;
import java.util.ArrayList;
import java.util.List;
@@ -38,6 +39,7 @@ import java.util.List;
@SearchIndexable(forTarget = SearchIndexable.ALL & ~SearchIndexable.ARC)
public class NotificationSettings extends SettingsPreferenceFragment implements Preference.OnPreferenceChangeListener{
private static final String INCALL_VIB_OPTIONS = "incall_vib_options";
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
@@ -46,6 +48,11 @@ public class NotificationSettings extends SettingsPreferenceFragment implements
ContentResolver resolver = getActivity().getContentResolver();
final PreferenceScreen prefScreen = getPreferenceScreen();
final Resources res = getResources();
PreferenceCategory incallVibCategory = (PreferenceCategory) findPreference(INCALL_VIB_OPTIONS);
if (!Utils.isVoiceCapable(getActivity())) {
prefScreen.removePreference(incallVibCategory);
}
}

View File

@@ -17,14 +17,31 @@
package com.cherish.settings.utils;
import static android.os.UserHandle.USER_SYSTEM;
import android.content.Context;
import android.content.om.IOverlayManager;
import android.os.AsyncTask;
import android.os.RemoteException;
import android.widget.Toast;
import android.app.Activity;
import android.app.ActivityManager;
import android.content.Context;
import android.content.pm.ActivityInfo;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.content.pm.Signature;
import android.content.res.Configuration;
import android.hardware.camera2.CameraAccessException;
import android.hardware.camera2.CameraCharacteristics;
import android.hardware.camera2.CameraManager;
import android.net.ConnectivityManager;
import android.os.UserManager;
import android.os.SystemProperties;
import android.telephony.TelephonyManager;
import android.util.DisplayMetrics;
import android.view.DisplayInfo;
import android.view.Surface;
import android.view.WindowManager;
import com.android.settings.R;
public class Utils {