Also added a setting next to push setting to go to Huawei settings for protected apps

This commit is contained in:
Sylvain Berfini 2018-12-10 17:26:01 +01:00
parent 9b0fa01310
commit 7c5f3dcb9c
4 changed files with 30 additions and 0 deletions

View file

@ -21,6 +21,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
import android.Manifest;
import android.app.AlertDialog;
import android.content.ComponentName;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
@ -234,6 +235,10 @@ public class SettingsFragment extends PreferencesListFragment {
hidePreference(R.string.pref_push_notification_key);
}
if (!"huawei".equalsIgnoreCase(android.os.Build.MANUFACTURER)) {
hidePreference(R.string.pref_huawei_protected_settings_key);
}
if (!Version.isVideoCapable()
|| !LinphoneManager.getLcIfManagerNotDestroyedOrNull().videoSupported()) {
emptyAndHidePreference(R.string.pref_video_key);
@ -1624,6 +1629,22 @@ public class SettingsFragment extends PreferencesListFragment {
}
});
findPreference(getString(R.string.pref_huawei_protected_settings_key))
.setOnPreferenceClickListener(
new OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
LinphonePreferences.instance().huaweiDialogPrompted(true);
Intent intent = new Intent();
intent.setComponent(
new ComponentName(
"com.huawei.systemmanager",
"com.huawei.systemmanager.optimize.process.ProtectActivity"));
startActivity(intent);
return true;
}
});
findPreference(getString(R.string.pref_ipv6_key))
.setOnPreferenceChangeListener(
new OnPreferenceChangeListener() {

View file

@ -83,6 +83,7 @@
<string name="pref_friendlist_subscribe_key">pref_friendlist_subscribe_key</string>
<string name="pref_link_account_key">pref_link_account_key</string>
<string name="pref_proxy_push_notif_key">pref_proxy_push_notif_key</string>
<string name="pref_huawei_protected_settings_key">pref_huawei_protected_settings_key</string>
<string name="pref_echo_cancellation_key">pref_echo_cancellation_key</string>
<string name="pref_autostart_key">pref_autostart_key</string>
<string name="pref_enable_outbound_proxy_key">Outbound proxy</string>

View file

@ -463,6 +463,8 @@
<string name="pref_media_encryption">Media encryption</string>
<string name="pref_push_notification">Enable push notifications</string>
<string name="pref_ipv6_title">Allow IPv6</string>
<string name="pref_huawei_protected_settings_title">Huawei protected apps settings</string>
<string name="pref_huawei_protected_settings_desc">This app must be enabled in order to receive push notifications</string>
<!-- Advanced settings -->
<string name="pref_advanced_title">Advanced</string>

View file

@ -348,6 +348,12 @@
android:persistent="false"
android:title="@string/pref_push_notification" />
<Preference
android:key="@string/pref_huawei_protected_settings_key"
android:persistent="false"
android:summary="@string/pref_huawei_protected_settings_desc"
android:title="@string/pref_huawei_protected_settings_title" />
<CheckBoxPreference
android:key="@string/pref_ipv6_key"
android:persistent="false"