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

Commit b2085ee0 authored by Android Build Coastguard Worker's avatar Android Build Coastguard Worker
Browse files

Snap for 10360508 from 6060f0ce to udc-release

Change-Id: Ibbd1e465380a9594685a3e6c3073f338891ca9a8
parents 1f4ffe6f 6060f0ce
Loading
Loading
Loading
Loading
+46 −13
Original line number Original line Diff line number Diff line
@@ -352,6 +352,16 @@ public class CallsManager extends Call.ListenerBase
    private final Set<Call> mCalls = Collections.newSetFromMap(
    private final Set<Call> mCalls = Collections.newSetFromMap(
            new ConcurrentHashMap<Call, Boolean>(8, 0.9f, 1));
            new ConcurrentHashMap<Call, Boolean>(8, 0.9f, 1));


    /**
     * List of self-managed calls that have been initialized but not yet added to
     * CallsManager#addCall(Call). There is a window of time when a Call has been added to Telecom
     * (e.g. TelecomManager#addNewIncomingCall) to actually added in CallsManager#addCall(Call).
     * This list is helpful for the NotificationManagerService to know that Telecom is currently
     * setting up a call which is an important set in making notifications non-dismissible.
     */
    private final Set<Call> mSelfManagedCallsBeingSetup = Collections.newSetFromMap(
            new ConcurrentHashMap<Call, Boolean>(8, 0.9f, 1));

    /**
    /**
     * A pending call is one which requires user-intervention in order to be placed.
     * A pending call is one which requires user-intervention in order to be placed.
     * Used by {@link #startCallConfirmation}.
     * Used by {@link #startCallConfirmation}.
@@ -1398,6 +1408,8 @@ public class CallsManager extends Call.ListenerBase
            // Required for backwards compatibility
            // Required for backwards compatibility
            handle = extras.getParcelable(TelephonyManager.EXTRA_INCOMING_NUMBER);
            handle = extras.getParcelable(TelephonyManager.EXTRA_INCOMING_NUMBER);
        }
        }
        PhoneAccount phoneAccount = mPhoneAccountRegistrar.getPhoneAccountUnchecked(
                phoneAccountHandle);
        Call call = new Call(
        Call call = new Call(
                generateNextCallId(extras),
                generateNextCallId(extras),
                mContext,
                mContext,
@@ -1414,6 +1426,15 @@ public class CallsManager extends Call.ListenerBase
                isConference, /* isConference */
                isConference, /* isConference */
                mClockProxy,
                mClockProxy,
                mToastFactory);
                mToastFactory);
        // Ensure new calls related to self-managed calls/connections are set as such. This will
        // be overridden when the actual connection is returned in startCreateConnection, however
        // doing this now ensures the logs and any other logic will treat this call as self-managed
        // from the moment it is created.
        boolean isSelfManaged = phoneAccount != null && phoneAccount.isSelfManaged();
        call.setIsSelfManaged(isSelfManaged);
        // It's important to start tracking self-managed calls as soon as the Call object is
        // initialized so NotificationManagerService is aware Telecom is setting up a call
        if (isSelfManaged) mSelfManagedCallsBeingSetup.add(call);


        // set properties for transactional call
        // set properties for transactional call
        if (extras.containsKey(TelecomManager.TRANSACTION_CALL_ID_KEY)) {
        if (extras.containsKey(TelecomManager.TRANSACTION_CALL_ID_KEY)) {
@@ -1434,15 +1455,8 @@ public class CallsManager extends Call.ListenerBase
            call.setAssociatedUser(phoneAccountHandle.getUserHandle());
            call.setAssociatedUser(phoneAccountHandle.getUserHandle());
        }
        }


        // Ensure new calls related to self-managed calls/connections are set as such. This will
        // be overridden when the actual connection is returned in startCreateConnection, however
        // doing this now ensures the logs and any other logic will treat this call as self-managed
        // from the moment it is created.
        PhoneAccount phoneAccount = mPhoneAccountRegistrar.getPhoneAccountUnchecked(
                phoneAccountHandle);
        if (phoneAccount != null) {
        if (phoneAccount != null) {
            Bundle phoneAccountExtras = phoneAccount.getExtras();
            Bundle phoneAccountExtras = phoneAccount.getExtras();
            call.setIsSelfManaged(phoneAccount.isSelfManaged());
            if (call.isSelfManaged()) {
            if (call.isSelfManaged()) {
                // Self managed calls will always be voip audio mode.
                // Self managed calls will always be voip audio mode.
                call.setIsVoipAudioMode(true);
                call.setIsVoipAudioMode(true);
@@ -1745,7 +1759,7 @@ public class CallsManager extends Call.ListenerBase
                    isConference ? participants : null,
                    isConference ? participants : null,
                    null /* gatewayInfo */,
                    null /* gatewayInfo */,
                    null /* connectionManagerPhoneAccount */,
                    null /* connectionManagerPhoneAccount */,
                    null /* requestedAccountHandle */,
                    requestedAccountHandle /* targetPhoneAccountHandle */,
                    Call.CALL_DIRECTION_OUTGOING /* callDirection */,
                    Call.CALL_DIRECTION_OUTGOING /* callDirection */,
                    false /* forceAttachToExistingConnection */,
                    false /* forceAttachToExistingConnection */,
                    isConference, /* isConference */
                    isConference, /* isConference */
@@ -1766,7 +1780,6 @@ public class CallsManager extends Call.ListenerBase
                                TelecomManager.PRESENTATION_ALLOWED);
                                TelecomManager.PRESENTATION_ALLOWED);
                    }
                    }
                }
                }
                call.setTargetPhoneAccount(requestedAccountHandle);
            }
            }


            call.initAnalytics(callingPackage, creationLogs.toString());
            call.initAnalytics(callingPackage, creationLogs.toString());
@@ -1805,6 +1818,9 @@ public class CallsManager extends Call.ListenerBase
        } else {
        } else {
            isReusedCall = true;
            isReusedCall = true;
        }
        }
        // It's important to start tracking self-managed calls as soon as the Call object is
        // initialized so NotificationManagerService is aware Telecom is setting up a call
        if (isSelfManaged) mSelfManagedCallsBeingSetup.add(call);


        int videoState = VideoProfile.STATE_AUDIO_ONLY;
        int videoState = VideoProfile.STATE_AUDIO_ONLY;
        if (extras != null) {
        if (extras != null) {
@@ -4241,6 +4257,7 @@ public class CallsManager extends Call.ListenerBase
        Log.i(this, "addCall(%s)", call);
        Log.i(this, "addCall(%s)", call);
        call.addListener(this);
        call.addListener(this);
        mCalls.add(call);
        mCalls.add(call);
        mSelfManagedCallsBeingSetup.remove(call);


        // Specifies the time telecom finished routing the call. This is used by the dialer for
        // Specifies the time telecom finished routing the call. This is used by the dialer for
        // analytics.
        // analytics.
@@ -4284,6 +4301,7 @@ public class CallsManager extends Call.ListenerBase
            mCalls.remove(call);
            mCalls.remove(call);
            shouldNotify = true;
            shouldNotify = true;
        }
        }
        mSelfManagedCallsBeingSetup.remove(call);


        call.destroy();
        call.destroy();
        updateExternalCallCanPullSupport();
        updateExternalCallCanPullSupport();
@@ -4541,8 +4559,10 @@ public class CallsManager extends Call.ListenerBase
     * @return {@code true} if the app has ongoing calls, or {@code false} otherwise.
     * @return {@code true} if the app has ongoing calls, or {@code false} otherwise.
     */
     */
    public boolean isInSelfManagedCall(String packageName, UserHandle userHandle) {
    public boolean isInSelfManagedCall(String packageName, UserHandle userHandle) {
        return mCalls.stream().anyMatch(
        return mSelfManagedCallsBeingSetup.stream().anyMatch(c -> c.isSelfManaged()
                c -> c.isSelfManaged()
                && c.getTargetPhoneAccount().getComponentName().getPackageName().equals(packageName)
                && c.getTargetPhoneAccount().getUserHandle().equals(userHandle)) ||
                mCalls.stream().anyMatch(c -> c.isSelfManaged()
                && c.getTargetPhoneAccount().getComponentName().getPackageName().equals(packageName)
                && c.getTargetPhoneAccount().getComponentName().getPackageName().equals(packageName)
                && c.getTargetPhoneAccount().getUserHandle().equals(userHandle));
                && c.getTargetPhoneAccount().getUserHandle().equals(userHandle));
    }
    }
@@ -4734,11 +4754,14 @@ public class CallsManager extends Call.ListenerBase
    }
    }


    /**
    /**
     * Determines if there are any self-managed calls.
     * Note: isInSelfManagedCall(packageName, UserHandle) should always be used in favor or this
     * method. This method determines if there are any self-managed calls globally.
     * @return {@code true} if there are self-managed calls, {@code false} otherwise.
     * @return {@code true} if there are self-managed calls, {@code false} otherwise.
     */
     */
    @VisibleForTesting
    public boolean hasSelfManagedCalls() {
    public boolean hasSelfManagedCalls() {
        return mCalls.stream().filter(call -> call.isSelfManaged()).count() > 0;
        return mSelfManagedCallsBeingSetup.size() > 0 ||
                mCalls.stream().filter(call -> call.isSelfManaged()).count() > 0;
    }
    }


    /**
    /**
@@ -6493,4 +6516,14 @@ public class CallsManager extends Call.ListenerBase
        }
        }
        call.getTransactionServiceWrapper().stopCallStreaming(call);
        call.getTransactionServiceWrapper().stopCallStreaming(call);
    }
    }

    @VisibleForTesting
    public Set<Call> getSelfManagedCallsBeingSetup() {
        return mSelfManagedCallsBeingSetup;
    }

    @VisibleForTesting
    public void addCallBeingSetup(Call call) {
        mSelfManagedCallsBeingSetup.add(call);
    }
}
}
+2 −4
Original line number Original line Diff line number Diff line
@@ -32,8 +32,6 @@
    <string name="request_speaker_endpoint" msgid="1033259535289845405">"Luidspreker"</string>
    <string name="request_speaker_endpoint" msgid="1033259535289845405">"Luidspreker"</string>
    <string name="request_bluetooth_endpoint" msgid="5933254250623451836">"Bluetooth"</string>
    <string name="request_bluetooth_endpoint" msgid="5933254250623451836">"Bluetooth"</string>
    <string name="start_stream" msgid="3567634786280097431">"begin stroom"</string>
    <string name="start_stream" msgid="3567634786280097431">"begin stroom"</string>
    <!-- no translation found for crash_app (2548690390730057704) -->
    <string name="crash_app" msgid="2548690390730057704">"gooi uitsondering"</string>
    <skip />
    <string name="update_notification" msgid="8677916482672588779">"dateer kennisgewing aan voortdurende oproepstyl op"</string>
    <!-- no translation found for update_notification (8677916482672588779) -->
    <skip />
</resources>
</resources>
+2 −4
Original line number Original line Diff line number Diff line
@@ -32,8 +32,6 @@
    <string name="request_speaker_endpoint" msgid="1033259535289845405">"ድምጽ ማውጫ"</string>
    <string name="request_speaker_endpoint" msgid="1033259535289845405">"ድምጽ ማውጫ"</string>
    <string name="request_bluetooth_endpoint" msgid="5933254250623451836">"ብሉቱዝ"</string>
    <string name="request_bluetooth_endpoint" msgid="5933254250623451836">"ብሉቱዝ"</string>
    <string name="start_stream" msgid="3567634786280097431">"ዥረት ይጀምሩ"</string>
    <string name="start_stream" msgid="3567634786280097431">"ዥረት ይጀምሩ"</string>
    <!-- no translation found for crash_app (2548690390730057704) -->
    <string name="crash_app" msgid="2548690390730057704">"ለየት ያለ ነገርን ይጣሉ"</string>
    <skip />
    <string name="update_notification" msgid="8677916482672588779">"በመካሄድ ላይ ላለ ጥሪ ቅጥ ማሳወቂያ ያዘምኑ"</string>
    <!-- no translation found for update_notification (8677916482672588779) -->
    <skip />
</resources>
</resources>
+2 −4
Original line number Original line Diff line number Diff line
@@ -32,8 +32,6 @@
    <string name="request_speaker_endpoint" msgid="1033259535289845405">"مكبّر الصوت"</string>
    <string name="request_speaker_endpoint" msgid="1033259535289845405">"مكبّر الصوت"</string>
    <string name="request_bluetooth_endpoint" msgid="5933254250623451836">"البلوتوث"</string>
    <string name="request_bluetooth_endpoint" msgid="5933254250623451836">"البلوتوث"</string>
    <string name="start_stream" msgid="3567634786280097431">"بدء البث"</string>
    <string name="start_stream" msgid="3567634786280097431">"بدء البث"</string>
    <!-- no translation found for crash_app (2548690390730057704) -->
    <string name="crash_app" msgid="2548690390730057704">"طرح استثناء"</string>
    <skip />
    <string name="update_notification" msgid="8677916482672588779">"إشعار التعديل إلى نمط المكالمات الجارية"</string>
    <!-- no translation found for update_notification (8677916482672588779) -->
    <skip />
</resources>
</resources>
+2 −4
Original line number Original line Diff line number Diff line
@@ -32,8 +32,6 @@
    <string name="request_speaker_endpoint" msgid="1033259535289845405">"স্পীকাৰ"</string>
    <string name="request_speaker_endpoint" msgid="1033259535289845405">"স্পীকাৰ"</string>
    <string name="request_bluetooth_endpoint" msgid="5933254250623451836">"ব্লুটুথ"</string>
    <string name="request_bluetooth_endpoint" msgid="5933254250623451836">"ব্লুটুথ"</string>
    <string name="start_stream" msgid="3567634786280097431">"ষ্ট্ৰীম কৰিবলৈ আৰম্ভ কৰক"</string>
    <string name="start_stream" msgid="3567634786280097431">"ষ্ট্ৰীম কৰিবলৈ আৰম্ভ কৰক"</string>
    <!-- no translation found for crash_app (2548690390730057704) -->
    <string name="crash_app" msgid="2548690390730057704">"থ্ৰ’ এক্সচেপশ্বন"</string>
    <skip />
    <string name="update_notification" msgid="8677916482672588779">"চলিত কলৰ শৈলী সম্পৰ্কে আপডে’ট দিয়া জাননী"</string>
    <!-- no translation found for update_notification (8677916482672588779) -->
    <skip />
</resources>
</resources>
Loading