diff options
| author | Hsin-Yi Chen <hsinyichen@google.com> | 2020-12-23 02:52:20 +0000 |
|---|---|---|
| committer | Hsin-Yi Chen <hsinyichen@google.com> | 2020-12-23 02:53:55 +0000 |
| commit | 456dc7619cd8903cbea31db12cc2c95d9f4bb1c9 (patch) | |
| tree | 89f17dac67eddb2059ce66a74f98e3d2e453eec5 /testapps | |
| parent | 789acacdfc97d52fd987d49fd70e1cc70ce3ad3b (diff) | |
| download | platform_packages_services_Telecomm-456dc7619cd8903cbea31db12cc2c95d9f4bb1c9.tar.gz platform_packages_services_Telecomm-456dc7619cd8903cbea31db12cc2c95d9f4bb1c9.tar.bz2 platform_packages_services_Telecomm-456dc7619cd8903cbea31db12cc2c95d9f4bb1c9.zip | |
Revert "Test app for call companion app"
This reverts commit 789acacdfc97d52fd987d49fd70e1cc70ce3ad3b.
Reason for revert: build breakage
Bug: 176200350
Change-Id: I7bd75c554f9d60d15efd832fba360ed8c5b03801
Diffstat (limited to 'testapps')
| -rw-r--r-- | testapps/companionapp/Android.bp | 24 | ||||
| -rw-r--r-- | testapps/companionapp/AndroidManifest.xml | 47 | ||||
| -rw-r--r-- | testapps/companionapp/res/drawable-hdpi/ic_android_black_24dp.png | bin | 341 -> 0 bytes | |||
| -rw-r--r-- | testapps/companionapp/res/drawable-mdpi/ic_android_black_24dp.png | bin | 213 -> 0 bytes | |||
| -rw-r--r-- | testapps/companionapp/res/drawable-xhdpi/ic_android_black_24dp.png | bin | 343 -> 0 bytes | |||
| -rw-r--r-- | testapps/companionapp/res/drawable-xxhdpi/ic_android_black_24dp.png | bin | 519 -> 0 bytes | |||
| -rw-r--r-- | testapps/companionapp/res/drawable-xxxhdpi/ic_android_black_24dp.png | bin | 641 -> 0 bytes | |||
| -rw-r--r-- | testapps/companionapp/res/layout/main.xml | 37 | ||||
| -rw-r--r-- | testapps/companionapp/src/com/android/server/telecom/companionapp/CompanionInCallServiceImpl.java | 78 | ||||
| -rw-r--r-- | testapps/companionapp/src/com/android/server/telecom/companionapp/CompanionTestApp.java | 168 |
10 files changed, 0 insertions, 354 deletions
diff --git a/testapps/companionapp/Android.bp b/testapps/companionapp/Android.bp deleted file mode 100644 index e3612a196..000000000 --- a/testapps/companionapp/Android.bp +++ /dev/null @@ -1,24 +0,0 @@ -// -// Copyright (C) 2019 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. -// - -android_test { - name: "TelecomCompanionApp", - static_libs: [ - "androidx.legacy_legacy-support-v4", - "guava", - ], - srcs: ["src/**/*.java"], -} diff --git a/testapps/companionapp/AndroidManifest.xml b/testapps/companionapp/AndroidManifest.xml deleted file mode 100644 index 7569d8feb..000000000 --- a/testapps/companionapp/AndroidManifest.xml +++ /dev/null @@ -1,47 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- Copyright (C) 2019 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.companionapp"> - - <uses-sdk android:minSdkVersion="28" - android:targetSdkVersion="29"/> - - <uses-permission android:name="android.permission.BLUETOOTH_ADMIN" /> - <uses-permission android:name="android.permission.MANAGE_ONGOING_CALLS" /> - <uses-feature android:name="android.software.companion_device_setup"/> - - <application android:label="Telecom Companion"> - <uses-library android:name="android.test.runner"/> - - <activity android:name="com.android.server.telecom.companionapp.CompanionTestApp" - android:label="CompanionTestApp"> - <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.LAUNCHER" /> - </intent-filter> - </activity> - - <service android:name="com.android.server.telecom.companionapp.CompanionInCallServiceImpl" - android:permission="android.permission.BIND_INCALL_SERVICE" - android:exported="true"> - <intent-filter> - <action android:name="android.telecom.InCallService"/> - </intent-filter> - </service> - </application> -</manifest> diff --git a/testapps/companionapp/res/drawable-hdpi/ic_android_black_24dp.png b/testapps/companionapp/res/drawable-hdpi/ic_android_black_24dp.png Binary files differdeleted file mode 100644 index ed3ee454d..000000000 --- a/testapps/companionapp/res/drawable-hdpi/ic_android_black_24dp.png +++ /dev/null diff --git a/testapps/companionapp/res/drawable-mdpi/ic_android_black_24dp.png b/testapps/companionapp/res/drawable-mdpi/ic_android_black_24dp.png Binary files differdeleted file mode 100644 index a4add5149..000000000 --- a/testapps/companionapp/res/drawable-mdpi/ic_android_black_24dp.png +++ /dev/null diff --git a/testapps/companionapp/res/drawable-xhdpi/ic_android_black_24dp.png b/testapps/companionapp/res/drawable-xhdpi/ic_android_black_24dp.png Binary files differdeleted file mode 100644 index 41558f251..000000000 --- a/testapps/companionapp/res/drawable-xhdpi/ic_android_black_24dp.png +++ /dev/null diff --git a/testapps/companionapp/res/drawable-xxhdpi/ic_android_black_24dp.png b/testapps/companionapp/res/drawable-xxhdpi/ic_android_black_24dp.png Binary files differdeleted file mode 100644 index 6006b1207..000000000 --- a/testapps/companionapp/res/drawable-xxhdpi/ic_android_black_24dp.png +++ /dev/null diff --git a/testapps/companionapp/res/drawable-xxxhdpi/ic_android_black_24dp.png b/testapps/companionapp/res/drawable-xxxhdpi/ic_android_black_24dp.png Binary files differdeleted file mode 100644 index 4f935bf59..000000000 --- a/testapps/companionapp/res/drawable-xxxhdpi/ic_android_black_24dp.png +++ /dev/null diff --git a/testapps/companionapp/res/layout/main.xml b/testapps/companionapp/res/layout/main.xml deleted file mode 100644 index e55375437..000000000 --- a/testapps/companionapp/res/layout/main.xml +++ /dev/null @@ -1,37 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- Copyright (C) 2020 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"> - <TextView - android:layout_width="fill_parent" - android:layout_height="wrap_content" - android:text="This is a test app for companion in call service." - android:padding="10dp" - android:textColor="#FFFFFF"/> - <Button - android:id="@+id/buttonStart" - android:layout_width="fill_parent" - android:layout_height="wrap_content" - android:text="Start Association"/> - <Button - android:id="@+id/buttonStop" - android:layout_width="fill_parent" - android:layout_height="wrap_content" - android:text="Stop Association"/> -</LinearLayout> diff --git a/testapps/companionapp/src/com/android/server/telecom/companionapp/CompanionInCallServiceImpl.java b/testapps/companionapp/src/com/android/server/telecom/companionapp/CompanionInCallServiceImpl.java deleted file mode 100644 index 890cd7728..000000000 --- a/testapps/companionapp/src/com/android/server/telecom/companionapp/CompanionInCallServiceImpl.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright (C) 2019 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.companionapp; - -import android.content.Intent; -import android.telecom.Call; -import android.telecom.InCallService; -import android.telecom.Phone; -import android.util.Log; -import android.widget.Toast; - -import java.lang.Override; -import java.lang.String; - -/** - * Test Companion In-Call service implementation. - */ -public class CompanionInCallServiceImpl extends InCallService { - private static final String TAG = "CompanionInCallServiceImpl"; - - private Phone mPhone; - - private Phone.Listener mPhoneListener = new Phone.Listener() { - @Override - public void onCallAdded(Phone phone, Call call) { - Log.i(TAG, "onCallAdded: " + call.toString()); - Toast.makeText( - CompanionInCallServiceImpl.this, "onCallAdded", Toast.LENGTH_LONG).show(); - } - - @Override - public void onCallRemoved(Phone phone, Call call) { - Log.i(TAG, "onCallRemoved: " + call.toString()); - Toast.makeText( - CompanionInCallServiceImpl.this, "onCallRemoved", Toast.LENGTH_LONG).show(); - } - }; - - @Override - public void onPhoneCreated(Phone phone) { - Log.i(TAG, "onPhoneCreated"); - mPhone = phone; - mPhone.addListener(mPhoneListener); - } - - @Override - public boolean onUnbind(Intent intent) { - Log.i(TAG, "Companion TestApp InCallService unbind"); - mPhone.removeListener(mPhoneListener); - mPhone = null; - return super.onUnbind(intent); - } - - /** - * Used to bind a call - * @param intent - * @return - */ - @Override - public android.os.IBinder onBind(Intent intent) { - Log.d(TAG, "Companion TestApp InCallService bind"); - return super.onBind(intent); - } -} diff --git a/testapps/companionapp/src/com/android/server/telecom/companionapp/CompanionTestApp.java b/testapps/companionapp/src/com/android/server/telecom/companionapp/CompanionTestApp.java deleted file mode 100644 index 7ed1e1e75..000000000 --- a/testapps/companionapp/src/com/android/server/telecom/companionapp/CompanionTestApp.java +++ /dev/null @@ -1,168 +0,0 @@ -/* - * Copyright (C) 2020 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.companionapp; - -import android.app.Activity; -import android.bluetooth.BluetoothDevice; -import android.companion.AssociationRequest; -import android.companion.BluetoothDeviceFilter; -import android.companion.CompanionDeviceManager; -import android.content.Intent; -import android.content.IntentSender; -import android.os.Bundle; -import android.os.ParcelUuid; -import android.util.Log; -import android.view.View; -import android.view.View.OnClickListener; -import android.widget.Button; -import android.widget.Toast; - -import java.util.UUID; -import java.util.regex.Pattern; - -/** - * Companion Test App in Telecom - */ -public class CompanionTestApp extends Activity { - - private static String logtag = "CompanionTestApp"; - private CompanionDeviceManager mDeviceManager; - private AssociationRequest mPairingRequest; - private BluetoothDeviceFilter mDeviceFilter; - - private static final int SELECT_DEVICE_REQUEST_CODE = 42; - - @Override - public void onCreate(Bundle savedInstanceState) { - setupDeviceAssociation(); - - super.onCreate(savedInstanceState); - setContentView(R.layout.main); - - Button buttonStart = (Button)findViewById(R.id.buttonStart); - buttonStart.setOnClickListener(startListener); - - Button buttonStop = (Button)findViewById(R.id.buttonStop); - buttonStop.setOnClickListener(stopListener); - } - - private OnClickListener startListener = new OnClickListener() { - public void onClick(View v) { - Log.d(logtag,"onClick() called - start button"); - Toast.makeText(CompanionTestApp.this, "Start Association", Toast.LENGTH_LONG).show(); - assosicate(); - Log.d(logtag,"onClick() ended - start button"); - } - }; - - private OnClickListener stopListener = new OnClickListener() { - public void onClick(View v) { - Log.d(logtag,"onClick() called - stop button"); - Toast.makeText(CompanionTestApp.this, "Stop Association", Toast.LENGTH_LONG).show(); - disassosicate(); - Log.d(logtag,"onClick() ended - stop button"); - } - }; - - // Setup Device Association Preparation, per - // https://developer.android.com/guide/topics/connectivity/companion-device-pairing - private void setupDeviceAssociation() { - mDeviceManager = getSystemService(CompanionDeviceManager.class); - - mDeviceFilter = new BluetoothDeviceFilter.Builder() - .build(); - - mPairingRequest = new AssociationRequest.Builder() - .addDeviceFilter(mDeviceFilter) - .setDeviceProfile(AssociationRequest.DEVICE_PROFILE_WATCH) - .build(); - - } - - // Associate bluetooth device, per - // https://developer.android.com/guide/topics/connectivity/companion-device-pairing - private void assosicate() { - // When the app tries to pair with the Bluetooth device, show the - // appropriate pairing request dialog to the user. - mDeviceManager.associate(mPairingRequest, - new CompanionDeviceManager.Callback() { - @Override - public void onDeviceFound(IntentSender chooserLauncher) { - try { - startIntentSenderForResult(chooserLauncher, - SELECT_DEVICE_REQUEST_CODE, null, 0, 0, 0); - } catch (Exception ex) { - Log.d(logtag, "Callback onDeviceFound() Exception: " + ex); - } - } - - @Override - public void onFailure(CharSequence error) { - Log.d(logtag, "Callback onFailure() called - error: " + error); - } - }, - null); - } - - // Disassociate the associated bluetooth device - private void disassosicate() { - for (String macAddress : mDeviceManager.getAssociations()) { - mDeviceManager.disassociate(macAddress); - } - } - - @Override - public void onActivityResult(int requestCode, int resultCode, Intent data) { - if (requestCode == SELECT_DEVICE_REQUEST_CODE && - resultCode == Activity.RESULT_OK) { - // User has chosen to pair with the Bluetooth device. - BluetoothDevice deviceToPair = - data.getParcelableExtra(CompanionDeviceManager.EXTRA_DEVICE); - deviceToPair.createBond(); - } - } - - @Override - protected void onStart() { - Log.d(logtag,"onStart() called"); - super.onStart(); - } - - @Override - protected void onResume() { - Log.d(logtag,"onResume() called"); - super.onResume(); - } - - @Override - protected void onPause() { - Log.d(logtag,"onPause() called"); - super.onPause(); - } - - @Override - protected void onStop() { - Log.d(logtag,"onStop() called"); - super.onStop(); - } - - @Override - protected void onDestroy() { - Log.d(logtag,"onDestroy() called"); - super.onDestroy(); - } -} |
