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

Commit 66b48e0f authored by Tyler Gunn's avatar Tyler Gunn Committed by Automerger Merge Worker
Browse files

Merge "Add Telecom Call Audio Test App." into sc-dev am: 8fca8565

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/services/Telecomm/+/14430420

Change-Id: I30e89c9bf8f80ab1e5c29647766fdd1b36125a80
parents 2b2d722a 8fca8565
Loading
Loading
Loading
Loading
+31 −0
Original line number Diff line number Diff line
//
// 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 {
    default_applicable_licenses: ["Android-Apache-2.0"],
}

android_test {
    name: "TelecomCallAudioTestApp",
    static_libs: [
        "androidx.legacy_legacy-support-v4",
        "guava",
    ],
    srcs: ["src/**/*.java"],
    platform_apis: true,
    certificate: "platform",
    privileged: true,
}
+58 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!-- 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.
-->

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
     coreApp="true"
     package="com.android.server.telecom.callaudiotest">

    <uses-sdk android:minSdkVersion="28"
         android:targetSdkVersion="29"/>
    <uses-permission android:name="android.permission.BLUETOOTH"/>
    <uses-permission android:name="android.permission.CALL_PHONE"/>
    <uses-permission android:name="android.permission.CONTROL_INCALL_EXPERIENCE"/>
    <uses-permission android:name="android.permission.READ_CALL_LOG"/>
    <uses-permission android:name="android.permission.READ_PHONE_STATE"/>
    <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS"/>
    <uses-permission android:name="android.permission.MODIFY_AUDIO_ROUTING"/>
    <uses-permission android:name="android.permission.MODIFY_PHONE_STATE"/>
    <uses-permission android:name="android.permission.WRITE_CALL_LOG"/>

    <application android:label="Telecom Call Audio Test">
        <uses-library android:name="android.test.runner"/>

        <service android:name="com.android.server.telecom.callaudiotest.CallAudioTestInCallService"
             android:permission="android.permission.BIND_INCALL_SERVICE"
             android:exported="true">
            <meta-data android:name="android.telecom.IN_CALL_SERVICE_CAR_MODE_UI"
                       android:value="false"/>
            <meta-data android:name="android.telecom.INCLUDE_SELF_MANAGED_CALLS"
                       android:value="false"/>
          <intent-filter>
              <action android:name="android.telecom.InCallService"/>
          </intent-filter>
        </service>

        <activity android:name="com.android.server.telecom.callaudiotest.CallAudioTestActivity"
             android:label="Call Audio Test"
             android:exported="true">
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.intent.category.DEFAULT"/>
                <category android:name="android.intent.category.LAUNCHER"/>
            </intent-filter>
        </activity>
    </application>
</manifest>
+41 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!-- 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.
-->

<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >
    <TextView
        android:id="@+id/appLabel"
        android:layout_gravity="left"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textSize="25dp"
        android:text="Call Audio Testing" />
    <TextView
        android:id="@+id/appDescription"
        android:layout_gravity="left"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textSize="12dp"
        android:text="You can enabled auto answer and calls will be answered and some awesome audio will be looped to the caller." />
    <CheckBox
        android:id="@+id/enableAutoAnswer"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Answer calls and loop audio" />
</LinearLayout>
+278 KiB

File added.

No diff preview for this file type.

+61 −0
Original line number Diff line number Diff line
/*
 * 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.server.telecom.callaudiotest;

import android.app.Activity;
import android.content.Intent;
import android.content.SharedPreferences;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.EditText;

/**
 * Activity to configure the auto answer behavior.
 */
public class CallAudioTestActivity extends Activity {
    private static final int RESULT_PICK_FILE = 1;
    public static final String AUDIO_TEST_PREFS = "audio_test_prefs";
    public static final String AUTO_ANSWER_ENABLED = "auto_answer_enabled";
    private CheckBox mEnable;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        setContentView(R.layout.call_audio_test_activity);
        mEnable = findViewById(R.id.enableAutoAnswer);
        mEnable.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
                SharedPreferences prefs = getSharedPreferences(AUDIO_TEST_PREFS, MODE_PRIVATE);
                SharedPreferences.Editor edit = prefs.edit();
                edit.putBoolean(AUTO_ANSWER_ENABLED, isChecked);
                edit.apply();
            }
        });
        loadPreferences();
    }

    private void loadPreferences() {
        SharedPreferences prefs = getSharedPreferences(AUDIO_TEST_PREFS, MODE_PRIVATE);
        mEnable.setChecked(prefs.getBoolean(AUTO_ANSWER_ENABLED, false));
    }
}
Loading