Add Telecom debug menu.
New menu is accessible via *#*#828282#*#*. This is a developer settings type activity for the Telecom subsystem. Adding in an option to enable the enhanced call blocking functionality to facilitate testing. Test: Manual Bug: 28189985 Change-Id: If7ce957e3e04f8f3de2251bb70dafb6b5834a6d8
This commit is contained in:
parent
b1445fde3c
commit
47eb3fe93e
|
@ -288,6 +288,10 @@
|
|||
<category android:name="android.intent.category.DEFAULT" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity android:name=".ui.TelecomDeveloperMenu"
|
||||
android:label="@string/developer_title"
|
||||
android:exported="false"
|
||||
android:process=":ui" />
|
||||
|
||||
<receiver android:name=".components.PrimaryCallReceiver"
|
||||
android:exported="true"
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ Copyright (C) 2018 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
|
||||
-->
|
||||
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent">
|
||||
|
||||
<Switch
|
||||
android:id="@+id/switchEnhancedCallBlocking"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/developer_enhanced_call_blocking"/>
|
||||
</LinearLayout>
|
|
@ -285,4 +285,10 @@
|
|||
<string name="phone_strings_emergency_call_made_dialog_title_txt">Emergency call made</string>
|
||||
<!-- Notification details that appear when the user taps the notification "phone_strings_call_blocking_turned_off_notification_text_txt". -->
|
||||
<string name="phone_strings_emergency_call_made_dialog_call_blocking_text_txt">Call Blocking has been disabled to allow emergency responders to contact you.</string>
|
||||
<!-- Window title used for the Telecom Developer Menu -->
|
||||
<string name="developer_title">Telecom Developer Menu</string>
|
||||
<!-- Label for a switch in the Telecom Developer Menu which is used to enable the enhanced call
|
||||
blocking functionality (for test purposes).
|
||||
DO NOT TRANSLATE -->
|
||||
<string name="developer_enhanced_call_blocking" translatable="false">Enhanced Call Blocking</string>
|
||||
</resources>
|
||||
|
|
|
@ -19,9 +19,12 @@ package com.android.server.telecom;
|
|||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.UserHandle;
|
||||
import android.telecom.Log;
|
||||
import android.telecom.TelecomManager;
|
||||
|
||||
import com.android.server.telecom.ui.TelecomDeveloperMenu;
|
||||
|
||||
/**
|
||||
* Receiver for "secret codes" broadcast by Dialer.
|
||||
*/
|
||||
|
@ -38,6 +41,9 @@ public class DialerCodeReceiver extends BroadcastReceiver {
|
|||
// Writes a MARK to the Telecom log.
|
||||
public static final String TELECOM_SECRET_CODE_MARK = "826275";
|
||||
|
||||
// Opens the Telecom developer menu.
|
||||
public static final String TELECOM_SECRET_CODE_MENU = "828282";
|
||||
|
||||
private final CallsManager mCallsManager;
|
||||
|
||||
DialerCodeReceiver(CallsManager callsManager) {
|
||||
|
@ -61,6 +67,11 @@ public class DialerCodeReceiver extends BroadcastReceiver {
|
|||
// add a non-call event.
|
||||
Call currentCall = mCallsManager.getActiveCall();
|
||||
Log.addEvent(currentCall, LogUtils.Events.USER_LOG_MARK);
|
||||
} else if (intent.getData().getHost().equals(TELECOM_SECRET_CODE_MENU)) {
|
||||
Log.i("DialerCodeReceiver", "Secret code used to open developer menu.");
|
||||
Intent confirmIntent = new Intent(context, TelecomDeveloperMenu.class);
|
||||
confirmIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
context.startActivityAsUser(confirmIntent, UserHandle.CURRENT);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,4 +36,14 @@ public class SystemSettingsUtil {
|
|||
return Settings.System.getInt(context.getContentResolver(),
|
||||
Settings.System.VIBRATE_WHEN_RINGING, 0) != 0;
|
||||
}
|
||||
|
||||
public boolean isEnhancedCallBlockingEnabled(Context context) {
|
||||
return Settings.System.getInt(context.getContentResolver(),
|
||||
Settings.System.DEBUG_ENABLE_ENHANCED_CALL_BLOCKING, 0) != 0;
|
||||
}
|
||||
|
||||
public boolean setEnhancedCallBlockingEnabled(Context context, boolean enabled) {
|
||||
return Settings.System.putInt(context.getContentResolver(),
|
||||
Settings.System.DEBUG_ENABLE_ENHANCED_CALL_BLOCKING, enabled ? 1 : 0);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -96,6 +96,8 @@ public class TelecomSystem {
|
|||
.addDataAuthority(DialerCodeReceiver.TELECOM_SECRET_CODE_DEBUG_OFF, null);
|
||||
DIALER_SECRET_CODE_FILTER
|
||||
.addDataAuthority(DialerCodeReceiver.TELECOM_SECRET_CODE_MARK, null);
|
||||
DIALER_SECRET_CODE_FILTER
|
||||
.addDataAuthority(DialerCodeReceiver.TELECOM_SECRET_CODE_MENU, null);
|
||||
}
|
||||
|
||||
private static TelecomSystem INSTANCE = null;
|
||||
|
|
|
@ -33,6 +33,7 @@ import android.text.TextDirectionHeuristics;
|
|||
import android.widget.Toast;
|
||||
|
||||
import com.android.server.telecom.R;
|
||||
import com.android.server.telecom.SystemSettingsUtil;
|
||||
import com.android.server.telecom.ui.NotificationChannelManager;
|
||||
|
||||
import java.util.Locale;
|
||||
|
@ -134,7 +135,8 @@ public final class BlockedNumbersUtil {
|
|||
carrierConfig = configManager.getDefaultConfig();
|
||||
}
|
||||
return carrierConfig.getBoolean(
|
||||
CarrierConfigManager.KEY_SUPPORT_ENHANCED_CALL_BLOCKING_BOOL);
|
||||
CarrierConfigManager.KEY_SUPPORT_ENHANCED_CALL_BLOCKING_BOOL)
|
||||
|| new SystemSettingsUtil().isEnhancedCallBlockingEnabled(context);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -0,0 +1,55 @@
|
|||
/*
|
||||
* Copyright (C) 2018 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.server.telecom.ui;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.os.Bundle;
|
||||
import android.widget.Switch;
|
||||
|
||||
import com.android.server.telecom.R;
|
||||
import com.android.server.telecom.SystemSettingsUtil;
|
||||
|
||||
/**
|
||||
* Telecom Developer Settings Menu.
|
||||
*/
|
||||
public class TelecomDeveloperMenu extends Activity {
|
||||
|
||||
private Switch mEnhancedCallingSwitch;
|
||||
private SystemSettingsUtil mSystemSettingsUtil;
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
mSystemSettingsUtil = new SystemSettingsUtil();
|
||||
setContentView(R.layout.telecom_developer_menu);
|
||||
|
||||
mEnhancedCallingSwitch = findViewById(R.id.switchEnhancedCallBlocking);
|
||||
mEnhancedCallingSwitch.setOnClickListener(l -> {
|
||||
handleEnhancedCallingToggle();
|
||||
});
|
||||
loadPreferences();
|
||||
}
|
||||
|
||||
private void handleEnhancedCallingToggle() {
|
||||
mSystemSettingsUtil.setEnhancedCallBlockingEnabled(this,
|
||||
mEnhancedCallingSwitch.isChecked());
|
||||
}
|
||||
|
||||
private void loadPreferences() {
|
||||
mEnhancedCallingSwitch.setChecked(mSystemSettingsUtil.isEnhancedCallBlockingEnabled(this));
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue