Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 47eb3fe9 authored by Tyler Gunn's avatar Tyler Gunn
Browse files

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
parent b1445fde
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -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"
+28 −0
Original line number Diff line number Diff line
<?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>
 No newline at end of file
+6 −0
Original line number Diff line number Diff line
@@ -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>
+11 −0
Original line number Diff line number Diff line
@@ -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);
            }
        }
    }
+10 −0
Original line number Diff line number Diff line
@@ -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);
    }
}
Loading