Add support for integrating call composer

* Minor bugfix in call log to handle USER_CURRENT
* add TelephonyLocalConnection that allows frameworks/opt/telephony to
call code (indirectly) in packages/services/Telephony

Bug: 177613111
Test: atest CallComposerTest

Change-Id: I602b51da6009c884364a026781ca3c160978fbd1
This commit is contained in:
Hall Liu
2021-01-21 10:05:43 -08:00
parent f4e7856ce9
commit 2d1bc540e4
3 changed files with 54 additions and 5 deletions

View File

@@ -249,11 +249,13 @@ public class CallLog {
// Nasty casework for the shadow calllog begins... // Nasty casework for the shadow calllog begins...
// First see if we're just inserting for one user. If so, insert into the shadow // First see if we're just inserting for one user. If so, insert into the shadow
// based on whether that user is unlocked. // based on whether that user is unlocked.
if (user != null) { UserHandle realUser = UserHandle.CURRENT.equals(user)
Uri baseUri = userManager.isUserUnlocked(user) ? CALL_COMPOSER_PICTURE_URI ? android.os.Process.myUserHandle() : user;
if (realUser != null) {
Uri baseUri = userManager.isUserUnlocked(realUser) ? CALL_COMPOSER_PICTURE_URI
: SHADOW_CALL_COMPOSER_PICTURE_URI; : SHADOW_CALL_COMPOSER_PICTURE_URI;
Uri pictureInsertionUri = ContentProvider.maybeAddUserId(baseUri, Uri pictureInsertionUri = ContentProvider.maybeAddUserId(baseUri,
user.getIdentifier()); realUser.getIdentifier());
Log.i(LOG_TAG, "Inserting call composer for single user at " Log.i(LOG_TAG, "Inserting call composer for single user at "
+ pictureInsertionUri); + pictureInsertionUri);

View File

@@ -324,10 +324,10 @@ public class TelecomManager {
*/ */
public static final String EXTRA_INCOMING_PICTURE = "android.telecom.extra.INCOMING_PICTURE"; public static final String EXTRA_INCOMING_PICTURE = "android.telecom.extra.INCOMING_PICTURE";
// TODO(hallliu), This UUID is obtained from TelephonyManager#uploadCallComposerPicture.
/** /**
* A ParcelUuid used as a token to represent a picture that was uploaded prior to the call * A ParcelUuid used as a token to represent a picture that was uploaded prior to the call
* being placed. * being placed. The value of this extra should be set using the {@link android.os.ParcelUuid}
* obtained from the callback in {@link TelephonyManager#uploadCallComposerPicture}.
*/ */
public static final String EXTRA_OUTGOING_PICTURE = "android.telecom.extra.OUTGOING_PICTURE"; public static final String EXTRA_OUTGOING_PICTURE = "android.telecom.extra.OUTGOING_PICTURE";

View File

@@ -0,0 +1,47 @@
/*
* 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 android.telephony;
import java.util.UUID;
/**
* Shim used for code in frameworks/opt/telephony to be able to call code in
* packages/services/Telephony. A singleton instance of this class is set when the phone process
* is brought up.
* @hide
*/
public class TelephonyLocalConnection {
public interface ConnectionImpl {
String getCallComposerServerUrlForHandle(int subscriptionId, UUID uuid);
}
private static ConnectionImpl sInstance;
public static String getCallComposerServerUrlForHandle(int subscriptionId, UUID uuid) {
checkInstance();
return sInstance.getCallComposerServerUrlForHandle(subscriptionId, uuid);
}
private static void checkInstance() {
if (sInstance == null) {
throw new IllegalStateException("Connection impl is null!");
}
}
public static void setInstance(ConnectionImpl impl) {
sInstance = impl;
}
}