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

Commit a749abce authored by Hall Liu's avatar Hall Liu
Browse files

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

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

+2 −2
Original line number Diff line number Diff line
@@ -324,10 +324,10 @@ public class TelecomManager {
     */
    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
     * 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";

+47 −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 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;
    }
}