diff options
24 files changed, 251 insertions, 571 deletions
diff --git a/api/current.txt b/api/current.txt index d6f785f0cb53..55a2adcb9170 100644 --- a/api/current.txt +++ b/api/current.txt @@ -37122,6 +37122,7 @@ package android.provider { field public static final String DURATION = "duration"; field public static final String EXTRA_CALL_TYPE_FILTER = "android.provider.extra.CALL_TYPE_FILTER"; field public static final String FEATURES = "features"; + field public static final int FEATURES_ASSISTED_DIALING_USED = 16; // 0x10 field public static final int FEATURES_HD_CALL = 4; // 0x4 field public static final int FEATURES_PULLED_EXTERNALLY = 2; // 0x2 field public static final int FEATURES_RTT = 32; // 0x20 @@ -43394,6 +43395,7 @@ package android.telecom { field public static final int DIRECTION_INCOMING = 0; // 0x0 field public static final int DIRECTION_OUTGOING = 1; // 0x1 field public static final int DIRECTION_UNKNOWN = -1; // 0xffffffff + field public static final int PROPERTY_ASSISTED_DIALING_USED = 512; // 0x200 field public static final int PROPERTY_CONFERENCE = 1; // 0x1 field public static final int PROPERTY_EMERGENCY_CALLBACK_MODE = 4; // 0x4 field public static final int PROPERTY_ENTERPRISE_CALL = 32; // 0x20 @@ -43507,6 +43509,7 @@ package android.telecom { method public final void removeConnection(android.telecom.Connection); method public final void removeExtras(java.util.List<java.lang.String>); method public final void removeExtras(java.lang.String...); + method public void sendConferenceEvent(@NonNull String, @Nullable android.os.Bundle); method public final void setActive(); method public final void setConferenceableConnections(java.util.List<android.telecom.Connection>); method public final void setConnectionCapabilities(int); @@ -43646,6 +43649,7 @@ package android.telecom { field public static final String EXTRA_IS_RTT_AUDIO_PRESENT = "android.telecom.extra.IS_RTT_AUDIO_PRESENT"; field public static final String EXTRA_LAST_FORWARDED_NUMBER = "android.telecom.extra.LAST_FORWARDED_NUMBER"; field public static final String EXTRA_SIP_INVITE = "android.telecom.extra.SIP_INVITE"; + field public static final int PROPERTY_ASSISTED_DIALING_USED = 512; // 0x200 field public static final int PROPERTY_HAS_CDMA_VOICE_PRIVACY = 32; // 0x20 field public static final int PROPERTY_HIGH_DEF_AUDIO = 4; // 0x4 field public static final int PROPERTY_IS_EXTERNAL_CALL = 16; // 0x10 @@ -44060,6 +44064,7 @@ package android.telecom { method public android.telecom.PhoneAccount getPhoneAccount(android.telecom.PhoneAccountHandle); method @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public java.util.List<android.telecom.PhoneAccountHandle> getSelfManagedPhoneAccounts(); method public android.telecom.PhoneAccountHandle getSimCallManager(); + method @Nullable public android.telecom.PhoneAccountHandle getSimCallManagerForSubscription(int); method @Nullable public String getSystemDialerPackage(); method @Nullable @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public android.telecom.PhoneAccountHandle getUserSelectedOutgoingPhoneAccount(); method @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public String getVoiceMailNumber(android.telecom.PhoneAccountHandle); @@ -44108,6 +44113,7 @@ package android.telecom { field public static final String EXTRA_START_CALL_WITH_RTT = "android.telecom.extra.START_CALL_WITH_RTT"; field public static final String EXTRA_START_CALL_WITH_SPEAKERPHONE = "android.telecom.extra.START_CALL_WITH_SPEAKERPHONE"; field public static final String EXTRA_START_CALL_WITH_VIDEO_STATE = "android.telecom.extra.START_CALL_WITH_VIDEO_STATE"; + field public static final String EXTRA_USE_ASSISTED_DIALING = "android.telecom.extra.USE_ASSISTED_DIALING"; field public static final String GATEWAY_ORIGINAL_ADDRESS = "android.telecom.extra.GATEWAY_ORIGINAL_ADDRESS"; field public static final String GATEWAY_PROVIDER_PACKAGE = "android.telecom.extra.GATEWAY_PROVIDER_PACKAGE"; field public static final String METADATA_INCLUDE_EXTERNAL_CALLS = "android.telecom.INCLUDE_EXTERNAL_CALLS"; diff --git a/api/system-current.txt b/api/system-current.txt index 770950665daf..d5f544c5757a 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -7243,14 +7243,18 @@ package android.telecom { public abstract class Conference extends android.telecom.Conferenceable { method @Deprecated public final android.telecom.AudioState getAudioState(); method @Deprecated public final long getConnectTimeMillis(); + method public final long getConnectionStartElapsedRealTime(); method public android.telecom.Connection getPrimaryConnection(); + method @NonNull public final String getTelecomCallId(); method @Deprecated public void onAudioStateChanged(android.telecom.AudioState); + method public final void setAddress(@NonNull android.net.Uri, int); + method public final void setCallerDisplayName(@NonNull String, int); + method public void setConferenceState(boolean); method @Deprecated public final void setConnectTimeMillis(long); } public abstract class Connection extends android.telecom.Conferenceable { method @Deprecated public final android.telecom.AudioState getAudioState(); - method public final int getCallRadioTech(); method public final long getConnectElapsedTimeMillis(); method public final long getConnectTimeMillis(); method @Nullable public android.telecom.PhoneAccountHandle getPhoneAccountHandle(); @@ -7258,7 +7262,6 @@ package android.telecom { method @Deprecated public void onAudioStateChanged(android.telecom.AudioState); method public final void resetConnectionTime(); method public void setCallDirection(int); - method public final void setCallRadioTech(int); method public final void setConnectTimeMillis(long); method public final void setConnectionStartElapsedRealTime(long); method public void setPhoneAccountHandle(@NonNull android.telecom.PhoneAccountHandle); @@ -7272,6 +7275,10 @@ package android.telecom { field public static final int PROPERTY_REMOTELY_HOSTED = 2048; // 0x800 } + public abstract class ConnectionService extends android.app.Service { + method public final void addExistingConnection(@NonNull android.telecom.PhoneAccountHandle, @NonNull android.telecom.Connection, @NonNull android.telecom.Conference); + } + public abstract class InCallService extends android.app.Service { method @Deprecated public android.telecom.Phone getPhone(); method @Deprecated public void onPhoneCreated(android.telecom.Phone); @@ -7403,6 +7410,10 @@ package android.telecom { field public static final int CAPABILITY_MULTI_USER = 32; // 0x20 } + public static class PhoneAccount.Builder { + method @NonNull public android.telecom.PhoneAccount.Builder setGroupId(@NonNull String); + } + public class PhoneAccountSuggestionService extends android.app.Service { ctor public PhoneAccountSuggestionService(); method public void onAccountSuggestionRequest(@NonNull String); @@ -7474,6 +7485,7 @@ package android.telecom { method public int getCallState(); method public android.telecom.PhoneAccountHandle getConnectionManager(); method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public int getCurrentTtyMode(); + method @Nullable @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public String getDefaultDialerPackage(int); method @Deprecated public android.content.ComponentName getDefaultPhoneApp(); method public java.util.List<android.telecom.PhoneAccountHandle> getPhoneAccountsForPackage(); method @RequiresPermission(anyOf={android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE, android.Manifest.permission.READ_PHONE_STATE}) public java.util.List<android.telecom.PhoneAccountHandle> getPhoneAccountsSupportingScheme(String); diff --git a/api/test-current.txt b/api/test-current.txt index c24d4d351a44..35b1757dae17 100644 --- a/api/test-current.txt +++ b/api/test-current.txt @@ -2914,7 +2914,36 @@ package android.telecom { } public abstract class Conference extends android.telecom.Conferenceable { + method public final long getConnectionStartElapsedRealTime(); method public android.telecom.Connection getPrimaryConnection(); + method @NonNull public final String getTelecomCallId(); + method public final void setAddress(@NonNull android.net.Uri, int); + method public final void setCallerDisplayName(@NonNull String, int); + method public void setConferenceState(boolean); + } + + public abstract class Connection extends android.telecom.Conferenceable { + method public final long getConnectElapsedTimeMillis(); + method public final long getConnectTimeMillis(); + method @Nullable public android.telecom.PhoneAccountHandle getPhoneAccountHandle(); + method @Nullable public final String getTelecomCallId(); + method public final void resetConnectionTime(); + method public void setCallDirection(int); + method public final void setConnectTimeMillis(long); + method public final void setConnectionStartElapsedRealTime(long); + method public void setPhoneAccountHandle(@NonNull android.telecom.PhoneAccountHandle); + method public void setTelecomCallId(@NonNull String); + field public static final int CAPABILITY_CONFERENCE_HAS_NO_CHILDREN = 2097152; // 0x200000 + field public static final int CAPABILITY_SPEED_UP_MT_AUDIO = 262144; // 0x40000 + field public static final String EXTRA_DISABLE_ADD_CALL = "android.telecom.extra.DISABLE_ADD_CALL"; + field public static final int PROPERTY_EMERGENCY_CALLBACK_MODE = 1; // 0x1 + field public static final int PROPERTY_GENERIC_CONFERENCE = 2; // 0x2 + field public static final int PROPERTY_IS_DOWNGRADED_CONFERENCE = 64; // 0x40 + field public static final int PROPERTY_REMOTELY_HOSTED = 2048; // 0x800 + } + + public static class PhoneAccount.Builder { + method @NonNull public android.telecom.PhoneAccount.Builder setGroupId(@NonNull String); } public class PhoneAccountSuggestionService extends android.app.Service { @@ -2927,6 +2956,7 @@ package android.telecom { public class TelecomManager { method @RequiresPermission("android.permission.READ_PRIVILEGED_PHONE_STATE") public int getCurrentTtyMode(); + method @Nullable @RequiresPermission("android.permission.READ_PRIVILEGED_PHONE_STATE") public String getDefaultDialerPackage(int); method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean isInEmergencyCall(); method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setUserSelectedOutgoingPhoneAccount(@Nullable android.telecom.PhoneAccountHandle); field public static final int TTY_MODE_FULL = 1; // 0x1 diff --git a/core/java/android/provider/CallLog.java b/core/java/android/provider/CallLog.java index c91d42ba68d1..2cb0750a3346 100644 --- a/core/java/android/provider/CallLog.java +++ b/core/java/android/provider/CallLog.java @@ -227,7 +227,7 @@ public class CallLog { /** * Indicates the call underwent Assisted Dialing. - * @hide + * @see TelecomManager#EXTRA_USE_ASSISTED_DIALING */ public static final int FEATURES_ASSISTED_DIALING_USED = 1 << 4; diff --git a/libs/hwui/pipeline/skia/SkiaPipeline.cpp b/libs/hwui/pipeline/skia/SkiaPipeline.cpp index 87ef7fc9a6e1..06479776fc73 100644 --- a/libs/hwui/pipeline/skia/SkiaPipeline.cpp +++ b/libs/hwui/pipeline/skia/SkiaPipeline.cpp @@ -366,12 +366,12 @@ void SkiaPipeline::renderFrame(const LayerUpdateQueue& layers, const SkRect& cli // capture is enabled. SkCanvas* canvas = tryCapture(surface.get()); - renderFrameImpl(layers, clip, nodes, opaque, contentDrawBounds, canvas, preTransform); + renderFrameImpl(clip, nodes, opaque, contentDrawBounds, canvas, preTransform); endCapture(surface.get()); if (CC_UNLIKELY(Properties::debugOverdraw)) { - renderOverdraw(layers, clip, nodes, contentDrawBounds, surface, preTransform); + renderOverdraw(clip, nodes, contentDrawBounds, surface, preTransform); } ATRACE_NAME("flush commands"); @@ -387,7 +387,7 @@ static Rect nodeBounds(RenderNode& node) { } } // namespace -void SkiaPipeline::renderFrameImpl(const LayerUpdateQueue& layers, const SkRect& clip, +void SkiaPipeline::renderFrameImpl(const SkRect& clip, const std::vector<sp<RenderNode>>& nodes, bool opaque, const Rect& contentDrawBounds, SkCanvas* canvas, const SkMatrix& preTransform) { @@ -539,7 +539,7 @@ static const uint32_t kOverdrawColors[2][6] = { }, }; -void SkiaPipeline::renderOverdraw(const LayerUpdateQueue& layers, const SkRect& clip, +void SkiaPipeline::renderOverdraw(const SkRect& clip, const std::vector<sp<RenderNode>>& nodes, const Rect& contentDrawBounds, sk_sp<SkSurface> surface, const SkMatrix& preTransform) { @@ -553,7 +553,7 @@ void SkiaPipeline::renderOverdraw(const LayerUpdateQueue& layers, const SkRect& // each time a pixel would have been drawn. // Pass true for opaque so we skip the clear - the overdrawCanvas is already zero // initialized. - renderFrameImpl(layers, clip, nodes, true, contentDrawBounds, &overdrawCanvas, preTransform); + renderFrameImpl(clip, nodes, true, contentDrawBounds, &overdrawCanvas, preTransform); sk_sp<SkImage> counts = offscreen->makeImageSnapshot(); // Draw overdraw colors to the canvas. The color filter will convert counts to colors. diff --git a/libs/hwui/pipeline/skia/SkiaPipeline.h b/libs/hwui/pipeline/skia/SkiaPipeline.h index 215ff36ebb2b..7d575ad01936 100644 --- a/libs/hwui/pipeline/skia/SkiaPipeline.h +++ b/libs/hwui/pipeline/skia/SkiaPipeline.h @@ -77,7 +77,7 @@ protected: sk_sp<SkColorSpace> mSurfaceColorSpace; private: - void renderFrameImpl(const LayerUpdateQueue& layers, const SkRect& clip, + void renderFrameImpl(const SkRect& clip, const std::vector<sp<RenderNode>>& nodes, bool opaque, const Rect& contentDrawBounds, SkCanvas* canvas, const SkMatrix& preTransform); @@ -86,7 +86,7 @@ private: * Debugging feature. Draws a semi-transparent overlay on each pixel, indicating * how many times it has been drawn. */ - void renderOverdraw(const LayerUpdateQueue& layers, const SkRect& clip, + void renderOverdraw(const SkRect& clip, const std::vector<sp<RenderNode>>& nodes, const Rect& contentDrawBounds, sk_sp<SkSurface> surface, const SkMatrix& preTransform); diff --git a/packages/SystemUI/src/com/android/systemui/ForegroundServiceController.java b/packages/SystemUI/src/com/android/systemui/ForegroundServiceController.java index c2d090e00715..385de4acfea8 100644 --- a/packages/SystemUI/src/com/android/systemui/ForegroundServiceController.java +++ b/packages/SystemUI/src/com/android/systemui/ForegroundServiceController.java @@ -16,6 +16,7 @@ package com.android.systemui; import android.annotation.Nullable; import android.app.AppOpsManager; +import android.os.Handler; import android.os.UserHandle; import android.service.notification.StatusBarNotification; import android.util.ArraySet; @@ -23,13 +24,13 @@ import android.util.SparseArray; import com.android.internal.messages.nano.SystemMessageProto; import com.android.systemui.appops.AppOpsController; +import com.android.systemui.dagger.qualifiers.MainHandler; import com.android.systemui.statusbar.notification.NotificationEntryManager; import com.android.systemui.statusbar.notification.collection.NotificationEntry; import javax.inject.Inject; import javax.inject.Singleton; - /** * Tracks state of foreground services and notifications related to foreground services per user. */ @@ -44,12 +45,18 @@ public class ForegroundServiceController { private final SparseArray<ForegroundServicesUserState> mUserServices = new SparseArray<>(); private final Object mMutex = new Object(); private final NotificationEntryManager mEntryManager; + private final Handler mMainHandler; @Inject public ForegroundServiceController(NotificationEntryManager entryManager, - AppOpsController appOpsController) { + AppOpsController appOpsController, @MainHandler Handler mainHandler) { mEntryManager = entryManager; - appOpsController.addCallback(APP_OPS, this::onAppOpChanged); + mMainHandler = mainHandler; + appOpsController.addCallback(APP_OPS, (code, uid, packageName, active) -> { + mMainHandler.post(() -> { + onAppOpChanged(code, uid, packageName, active); + }); + }); } /** @@ -113,7 +120,7 @@ public class ForegroundServiceController { * @param packageName package that created the notification * @param active whether the appOpCode is active or not */ - public void onAppOpChanged(int appOpCode, int uid, String packageName, boolean active) { + void onAppOpChanged(int appOpCode, int uid, String packageName, boolean active) { int userId = UserHandle.getUserId(uid); // Record active app ops synchronized (mMutex) { @@ -132,7 +139,8 @@ public class ForegroundServiceController { // Update appOp if there's an associated pending or visible notification: final String foregroundKey = getStandardLayoutKey(userId, packageName); if (foregroundKey != null) { - final NotificationEntry entry = mEntryManager.getPendingOrCurrentNotif(foregroundKey); + final NotificationEntry entry = mEntryManager.getPendingOrCurrentNotif( + foregroundKey); if (entry != null && uid == entry.getSbn().getUid() && packageName.equals(entry.getSbn().getPackageName())) { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarIconView.java b/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarIconView.java index f4af9ae21b75..dc84b5785ad9 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarIconView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarIconView.java @@ -185,6 +185,16 @@ public class StatusBarIconView extends AnimatedImageView implements StatusIconDi maybeUpdateIconScaleDimens(); } + public StatusBarIconView(Context context, AttributeSet attrs) { + super(context, attrs); + mDozer = new NotificationIconDozeHelper(context); + mBlocked = false; + mAlwaysScaleIcon = true; + reloadDimens(); + maybeUpdateIconScaleDimens(); + mDensity = context.getResources().getDisplayMetrics().densityDpi; + } + /** Should always be preceded by {@link #reloadDimens()} */ private void maybeUpdateIconScaleDimens() { // We do not resize and scale system icons (on the right), only notification icons (on the @@ -277,16 +287,6 @@ public class StatusBarIconView extends AnimatedImageView implements StatusIconDi maybeUpdateIconScaleDimens(); } - public StatusBarIconView(Context context, AttributeSet attrs) { - super(context, attrs); - mDozer = new NotificationIconDozeHelper(context); - mBlocked = false; - mAlwaysScaleIcon = true; - reloadDimens(); - maybeUpdateIconScaleDimens(); - mDensity = context.getResources().getDisplayMetrics().densityDpi; - } - private static boolean streq(String a, String b) { if (a == b) { return true; diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationAlertingManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationAlertingManager.java index 005f01dc8df0..65f3fa94374b 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationAlertingManager.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationAlertingManager.java @@ -71,7 +71,7 @@ public class NotificationAlertingManager { } @Override - public void onPostEntryUpdated(NotificationEntry entry) { + public void onPreEntryUpdated(NotificationEntry entry) { updateAlertState(entry); } @@ -114,8 +114,8 @@ public class NotificationAlertingManager { private void updateAlertState(NotificationEntry entry) { boolean alertAgain = alertAgain(entry, entry.getSbn().getNotification()); - boolean shouldAlert; - shouldAlert = mNotificationInterruptionStateProvider.shouldHeadsUp(entry); + // includes check for whether this notification should be filtered: + boolean shouldAlert = mNotificationInterruptionStateProvider.shouldHeadsUp(entry); final boolean wasAlerting = mHeadsUpManager.isAlerting(entry.getKey()); if (wasAlerting) { if (shouldAlert) { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/VisualStabilityManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/VisualStabilityManager.java index 1daf48492ea0..1b57308f1c0f 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/VisualStabilityManager.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/VisualStabilityManager.java @@ -69,20 +69,13 @@ public class VisualStabilityManager implements OnHeadsUpChangedListener, Dumpabl notificationEntryManager.addNotificationEntryListener(new NotificationEntryListener() { @Override public void onPreEntryUpdated(NotificationEntry entry) { - final boolean mAmbientStateHasChanged = + final boolean ambientStateHasChanged = entry.isAmbient() != entry.getRow().isLowPriority(); - if (mAmbientStateHasChanged) { + if (ambientStateHasChanged) { + // note: entries are removed in onReorderingFinished mLowPriorityReorderingViews.add(entry); } } - - @Override - public void onPostEntryUpdated(NotificationEntry entry) { - // This line is technically not required as we'll get called as the hierarchy - // manager will call onReorderingFinished() immediately before this. - // TODO: Find a way to make this relationship more explicit - mLowPriorityReorderingViews.remove(entry); - } }); } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/logging/NotificationLogger.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/logging/NotificationLogger.java index b7f408ebe557..90c5502bd119 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/logging/NotificationLogger.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/logging/NotificationLogger.java @@ -220,8 +220,8 @@ public class NotificationLogger implements StateListener { } @Override - public void onEntryReinflated(NotificationEntry entry) { - mExpansionStateLogger.onEntryReinflated(entry.getKey()); + public void onPreEntryUpdated(NotificationEntry entry) { + mExpansionStateLogger.onEntryUpdated(entry.getKey()); } @Override @@ -480,7 +480,7 @@ public class NotificationLogger implements StateListener { } @VisibleForTesting - void onEntryReinflated(String key) { + void onEntryUpdated(String key) { // When the notification is updated, we should consider the notification as not // yet logged. mLoggedExpansionState.remove(key); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java index 8d50f584d88f..0d8e30ef6988 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java @@ -608,10 +608,10 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd mEntryManager.addNotificationEntryListener(new NotificationEntryListener() { @Override - public void onPostEntryUpdated(NotificationEntry entry) { - if (!entry.getSbn().isClearable()) { - // The user may have performed a dismiss action on the notification, since it's - // not clearable we should snap it back. + public void onPreEntryUpdated(NotificationEntry entry) { + if (entry.rowExists() && !entry.getSbn().isClearable()) { + // If the row already exists, the user may have performed a dismiss action on + // the notification. Since it's not clearable we should snap it back. snapViewIfNeeded(entry); } } diff --git a/packages/SystemUI/tests/src/com/android/systemui/ForegroundServiceControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/ForegroundServiceControllerTest.java index bb4387eb4a2d..e63b6d6670fd 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/ForegroundServiceControllerTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/ForegroundServiceControllerTest.java @@ -33,6 +33,7 @@ import android.app.AppOpsManager; import android.app.Notification; import android.app.NotificationManager; import android.os.Bundle; +import android.os.Handler; import android.os.UserHandle; import android.service.notification.StatusBarNotification; import android.widget.RemoteViews; @@ -64,11 +65,12 @@ public class ForegroundServiceControllerTest extends SysuiTestCase { private NotificationEntryListener mEntryListener; @Mock private NotificationEntryManager mEntryManager; @Mock private AppOpsController mAppOpsController; + @Mock private Handler mMainHandler; @Before public void setUp() throws Exception { MockitoAnnotations.initMocks(this); - mFsc = new ForegroundServiceController(mEntryManager, mAppOpsController); + mFsc = new ForegroundServiceController(mEntryManager, mAppOpsController, mMainHandler); mListener = new ForegroundServiceNotificationListener( mContext, mFsc, mEntryManager); ArgumentCaptor<NotificationEntryListener> entryListenerCaptor = diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/logging/ExpansionStateLoggerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/logging/ExpansionStateLoggerTest.java index 2b343c21fc8f..4f1ffbe50fc1 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/logging/ExpansionStateLoggerTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/logging/ExpansionStateLoggerTest.java @@ -158,7 +158,7 @@ public class ExpansionStateLoggerTest extends SysuiTestCase { } @Test - public void testOnEntryReinflated() throws RemoteException { + public void testOnEntryUpdated() throws RemoteException { mLogger.onExpansionChanged(NOTIFICATION_KEY, true, true, NotificationVisibility.NotificationLocation.LOCATION_UNKNOWN); mLogger.onVisibilityChanged( @@ -168,7 +168,7 @@ public class ExpansionStateLoggerTest extends SysuiTestCase { verify(mBarService).onNotificationExpansionChanged( NOTIFICATION_KEY, true, true, ExpandableViewState.LOCATION_UNKNOWN); - mLogger.onEntryReinflated(NOTIFICATION_KEY); + mLogger.onEntryUpdated(NOTIFICATION_KEY); mLogger.onVisibilityChanged( Collections.singletonList(createNotificationVisibility(NOTIFICATION_KEY, true)), Collections.emptyList()); diff --git a/telecomm/java/android/telecom/Call.java b/telecomm/java/android/telecom/Call.java index 60290e3b785d..24b40460066b 100644 --- a/telecomm/java/android/telecom/Call.java +++ b/telecomm/java/android/telecom/Call.java @@ -512,8 +512,8 @@ public final class Call { /** * Indicates the call used Assisted Dialing. - * See also {@link Connection#PROPERTY_ASSISTED_DIALING_USED} - * @hide + * + * @see TelecomManager#EXTRA_USE_ASSISTED_DIALING */ public static final int PROPERTY_ASSISTED_DIALING_USED = 0x00000200; @@ -1181,7 +1181,8 @@ public final class Call { public void onConferenceableCallsChanged(Call call, List<Call> conferenceableCalls) {} /** - * Invoked when a {@link Call} receives an event from its associated {@link Connection}. + * Invoked when a {@link Call} receives an event from its associated {@link Connection} or + * {@link Conference}. * <p> * Where possible, the Call should make an attempt to handle {@link Connection} events which * are part of the {@code android.telecom.*} namespace. The Call should ignore any events @@ -1189,7 +1190,8 @@ public final class Call { * possible that a {@link ConnectionService} has defined its own Connection events which a * Call is not aware of. * <p> - * See {@link Connection#sendConnectionEvent(String, Bundle)}. + * See {@link Connection#sendConnectionEvent(String, Bundle)}, + * {@link Conference#sendConferenceEvent(String, Bundle)}. * * @param call The {@code Call} receiving the event. * @param event The event. diff --git a/telecomm/java/android/telecom/Conference.java b/telecomm/java/android/telecom/Conference.java index d90f46dcf326..58abf0051539 100644 --- a/telecomm/java/android/telecom/Conference.java +++ b/telecomm/java/android/telecom/Conference.java @@ -50,7 +50,7 @@ public abstract class Conference extends Conferenceable { public static final long CONNECT_TIME_NOT_SPECIFIED = 0; /** @hide */ - public abstract static class Listener { + abstract static class Listener { public void onStateChanged(Conference conference, int oldState, int newState) {} public void onDisconnected(Conference conference, DisconnectCause disconnectCause) {} public void onConnectionAdded(Conference conference, Connection connection) {} @@ -121,11 +121,17 @@ public abstract class Conference extends Conferenceable { /** * Returns the telecom internal call ID associated with this conference. + * <p> + * Note: This is ONLY used for debugging purposes so that the Telephony stack can better + * associate logs in Telephony with those in Telecom. + * The ID returned should not be used for any other purpose. * * @return The telecom call ID. * @hide */ - public final String getTelecomCallId() { + @SystemApi + @TestApi + public final @NonNull String getTelecomCallId() { return mTelecomCallId; } @@ -187,55 +193,6 @@ public abstract class Conference extends Conferenceable { } /** - * Whether the given capabilities support the specified capability. - * - * @param capabilities A capability bit field. - * @param capability The capability to check capabilities for. - * @return Whether the specified capability is supported. - * @hide - */ - public static boolean can(int capabilities, int capability) { - return (capabilities & capability) != 0; - } - - /** - * Whether the capabilities of this {@code Connection} supports the specified capability. - * - * @param capability The capability to check capabilities for. - * @return Whether the specified capability is supported. - * @hide - */ - public boolean can(int capability) { - return can(mConnectionCapabilities, capability); - } - - /** - * Removes the specified capability from the set of capabilities of this {@code Conference}. - * - * @param capability The capability to remove from the set. - * @hide - */ - public void removeCapability(int capability) { - int newCapabilities = mConnectionCapabilities; - newCapabilities &= ~capability; - - setConnectionCapabilities(newCapabilities); - } - - /** - * Adds the specified capability to the set of capabilities of this {@code Conference}. - * - * @param capability The capability to add to the set. - * @hide - */ - public void addCapability(int capability) { - int newCapabilities = mConnectionCapabilities; - newCapabilities |= capability; - - setConnectionCapabilities(newCapabilities); - } - - /** * @return The audio state of the conference, describing how its audio is currently * being routed by the system. This is {@code null} if this Conference * does not directly know about its audio state. @@ -554,7 +511,7 @@ public abstract class Conference extends Conferenceable { * @return This conference. * @hide */ - public final Conference addListener(Listener listener) { + final Conference addListener(Listener listener) { mListeners.add(listener); return this; } @@ -566,7 +523,7 @@ public abstract class Conference extends Conferenceable { * @return This conference. * @hide */ - public final Conference removeListener(Listener listener) { + final Conference removeListener(Listener listener) { mListeners.remove(listener); return this; } @@ -588,20 +545,6 @@ public abstract class Conference extends Conferenceable { } /** - * Updates RIL voice radio technology used for current conference after its creation. - * - * @hide - */ - public void updateCallRadioTechAfterCreation() { - final Connection primaryConnection = getPrimaryConnection(); - if (primaryConnection != null) { - setCallRadioTech(primaryConnection.getCallRadioTech()); - } else { - Log.w(this, "No primary connection found while updateCallRadioTechAfterCreation"); - } - } - - /** * @hide * @deprecated Use {@link #setConnectionTime}. */ @@ -669,49 +612,24 @@ public abstract class Conference extends Conferenceable { * Retrieves the connection start time of the {@link Conference}, if specified. A value of * {@link #CONNECT_TIME_NOT_SPECIFIED} indicates that Telecom should determine the start time * of the conference. - * + * <p> * This is based on the value of {@link SystemClock#elapsedRealtime()} to ensure that it is not * impacted by wall clock changes (user initiated, network initiated, time zone change, etc). + * <p> + * Note: This is only exposed for use by the Telephony framework which needs it to copy + * conference start times among conference participants. It is exposed as a system API since it + * has no general use other than to the Telephony framework. * * @return The elapsed time at which the {@link Conference} was connected. * @hide */ + @SystemApi + @TestApi public final long getConnectionStartElapsedRealTime() { return mConnectionStartElapsedRealTime; } /** - * Sets RIL voice radio technology used for current conference. - * - * @param vrat the RIL voice radio technology used for current conference, - * see {@code RIL_RADIO_TECHNOLOGY_*} in {@link android.telephony.ServiceState}. - * - * @hide - */ - public final void setCallRadioTech(@RilRadioTechnology int vrat) { - putExtra(TelecomManager.EXTRA_CALL_NETWORK_TYPE, - ServiceState.rilRadioTechnologyToNetworkType(vrat)); - } - - /** - * Returns RIL voice radio technology used for current conference. - * - * @return the RIL voice radio technology used for current conference, - * see {@code RIL_RADIO_TECHNOLOGY_*} in {@link android.telephony.ServiceState}. - * - * @hide - */ - public final @RilRadioTechnology int getCallRadioTech() { - int voiceNetworkType = TelephonyManager.NETWORK_TYPE_UNKNOWN; - Bundle extras = getExtras(); - if (extras != null) { - voiceNetworkType = extras.getInt(TelecomManager.EXTRA_CALL_NETWORK_TYPE, - TelephonyManager.NETWORK_TYPE_UNKNOWN); - } - return ServiceState.networkTypeToRilRadioTechnology(voiceNetworkType); - } - - /** * Inform this Conference that the state of its audio output has been changed externally. * * @param state The new audio state. @@ -970,11 +888,15 @@ public abstract class Conference extends Conferenceable { * single-party call when the participant count drops to 1. Although the dialer/phone app * could perform this trickery, it makes sense to do this in Telephony since a fix there will * ensure that bluetooth head units, auto and wearable apps all behave consistently. + * <p> + * This API is intended for use by the platform Telephony stack only. * * @param isConference {@code true} if this {@link Conference} should be treated like a * conference call, {@code false} if it should be treated like a single-party call. * @hide */ + @SystemApi + @TestApi public void setConferenceState(boolean isConference) { for (Listener l : mListeners) { l.onConferenceStateChanged(this, isConference); @@ -984,13 +906,19 @@ public abstract class Conference extends Conferenceable { /** * Sets the address of this {@link Conference}. Used when {@link #setConferenceState(boolean)} * is called to mark a conference temporarily as NOT a conference. + * <p> + * Note: This is a Telephony-specific implementation detail related to IMS conferences. It is + * not intended for use outside of the Telephony stack. * * @param address The new address. * @param presentation The presentation requirements for the address. * See {@link TelecomManager} for valid values. * @hide */ - public final void setAddress(Uri address, int presentation) { + @SystemApi + @TestApi + public final void setAddress(@NonNull Uri address, + @TelecomManager.Presentation int presentation) { Log.d(this, "setAddress %s", address); mAddress = address; mAddressPresentation = presentation; @@ -1056,13 +984,19 @@ public abstract class Conference extends Conferenceable { * Sets the caller display name (CNAP) of this {@link Conference}. Used when * {@link #setConferenceState(boolean)} is called to mark a conference temporarily as NOT a * conference. + * <p> + * Note: This is a Telephony-specific implementation detail related to IMS conferences. It is + * not intended for use outside of the Telephony stack. * * @param callerDisplayName The new display name. * @param presentation The presentation requirements for the handle. * See {@link TelecomManager} for valid values. * @hide */ - public final void setCallerDisplayName(String callerDisplayName, int presentation) { + @SystemApi + @TestApi + public final void setCallerDisplayName(@NonNull String callerDisplayName, + @TelecomManager.Presentation int presentation) { Log.d(this, "setCallerDisplayName %s", callerDisplayName); mCallerDisplayName = callerDisplayName; mCallerDisplayNamePresentation = presentation; @@ -1089,10 +1023,15 @@ public abstract class Conference extends Conferenceable { } /** - * See {@link Connection#sendConnectionEvent(String, Bundle)} - * @hide + * Sends an event associated with this {@code Conference} with associated event extras to the + * {@link InCallService} (note: this is identical in concept to + * {@link Connection#sendConnectionEvent(String, Bundle)}). + * @see Connection#sendConnectionEvent(String, Bundle) + * + * @param event The connection event. + * @param extras Optional bundle containing extra information associated with the event. */ - public void sendConnectionEvent(String event, Bundle extras) { + public void sendConferenceEvent(@NonNull String event, @Nullable Bundle extras) { for (Listener l : mListeners) { l.onConnectionEvent(this, event, extras); } diff --git a/telecomm/java/android/telecom/ConferenceParticipant.java b/telecomm/java/android/telecom/ConferenceParticipant.java deleted file mode 100644 index 5e4818a67b31..000000000000 --- a/telecomm/java/android/telecom/ConferenceParticipant.java +++ /dev/null @@ -1,348 +0,0 @@ -/* - * Copyright (C) 2014 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.telecom; - -import android.net.Uri; -import android.os.Parcel; -import android.os.Parcelable; -import android.telephony.PhoneNumberUtils; -import android.text.TextUtils; - -import com.android.internal.annotations.VisibleForTesting; -import com.android.internal.telephony.PhoneConstants; - -/** - * Parcelable representation of a participant's state in a conference call. - * @hide - */ -public class ConferenceParticipant implements Parcelable { - - /** - * RFC5767 states that a SIP URI with an unknown number should use an address of - * {@code anonymous@anonymous.invalid}. E.g. the host name is anonymous.invalid. - */ - private static final String ANONYMOUS_INVALID_HOST = "anonymous.invalid"; - /** - * The conference participant's handle (e.g., phone number). - */ - private final Uri mHandle; - - /** - * The display name for the participant. - */ - private final String mDisplayName; - - /** - * The endpoint Uri which uniquely identifies this conference participant. E.g. for an IMS - * conference call, this is the endpoint URI for the participant on the IMS conference server. - */ - private final Uri mEndpoint; - - /** - * The state of the participant in the conference. - * - * @see android.telecom.Connection - */ - private final int mState; - - /** - * The connect time of the participant. - */ - private long mConnectTime; - - /** - * The connect elapsed time of the participant. - */ - private long mConnectElapsedTime; - - /** - * The direction of the call; - * {@link Call.Details#DIRECTION_INCOMING} for incoming calls, or - * {@link Call.Details#DIRECTION_OUTGOING} for outgoing calls. - */ - private int mCallDirection; - - /** - * Creates an instance of {@code ConferenceParticipant}. - * - * @param handle The conference participant's handle (e.g., phone number). - * @param displayName The display name for the participant. - * @param endpoint The enpoint Uri which uniquely identifies this conference participant. - * @param state The state of the participant in the conference. - * @param callDirection The direction of the call (incoming/outgoing). - */ - public ConferenceParticipant(Uri handle, String displayName, Uri endpoint, int state, - int callDirection) { - mHandle = handle; - mDisplayName = displayName; - mEndpoint = endpoint; - mState = state; - mCallDirection = callDirection; - } - - /** - * Responsible for creating {@code ConferenceParticipant} objects for deserialized Parcels. - */ - public static final @android.annotation.NonNull Parcelable.Creator<ConferenceParticipant> CREATOR = - new Parcelable.Creator<ConferenceParticipant>() { - - @Override - public ConferenceParticipant createFromParcel(Parcel source) { - ClassLoader classLoader = ParcelableCall.class.getClassLoader(); - Uri handle = source.readParcelable(classLoader); - String displayName = source.readString(); - Uri endpoint = source.readParcelable(classLoader); - int state = source.readInt(); - long connectTime = source.readLong(); - long elapsedRealTime = source.readLong(); - int callDirection = source.readInt(); - ConferenceParticipant participant = - new ConferenceParticipant(handle, displayName, endpoint, state, - callDirection); - participant.setConnectTime(connectTime); - participant.setConnectElapsedTime(elapsedRealTime); - participant.setCallDirection(callDirection); - return participant; - } - - @Override - public ConferenceParticipant[] newArray(int size) { - return new ConferenceParticipant[size]; - } - }; - - @Override - public int describeContents() { - return 0; - } - - /** - * Determines the number presentation for a conference participant. Per RFC5767, if the host - * name contains {@code anonymous.invalid} we can assume that there is no valid caller ID - * information for the caller, otherwise we'll assume that the URI can be shown. - * - * @return The number presentation. - */ - @VisibleForTesting - public int getParticipantPresentation() { - Uri address = getHandle(); - if (address == null) { - return PhoneConstants.PRESENTATION_RESTRICTED; - } - - String number = address.getSchemeSpecificPart(); - // If no number, bail early and set restricted presentation. - if (TextUtils.isEmpty(number)) { - return PhoneConstants.PRESENTATION_RESTRICTED; - } - // Per RFC3261, the host name portion can also potentially include extra information: - // E.g. sip:anonymous1@anonymous.invalid;legid=1 - // In this case, hostName will be anonymous.invalid and there is an extra parameter for - // legid=1. - // Parameters are optional, and the address (e.g. test@test.com) will always be the first - // part, with any parameters coming afterwards. - String [] hostParts = number.split("[;]"); - String addressPart = hostParts[0]; - - // Get the number portion from the address part. - // This will typically be formatted similar to: 6505551212@test.com - String [] numberParts = addressPart.split("[@]"); - - // If we can't parse the host name out of the URI, then there is probably other data - // present, and is likely a valid SIP URI. - if (numberParts.length != 2) { - return PhoneConstants.PRESENTATION_ALLOWED; - } - String hostName = numberParts[1]; - - // If the hostname portion of the SIP URI is the invalid host string, presentation is - // restricted. - if (hostName.equals(ANONYMOUS_INVALID_HOST)) { - return PhoneConstants.PRESENTATION_RESTRICTED; - } - - return PhoneConstants.PRESENTATION_ALLOWED; - } - - /** - * Writes the {@code ConferenceParticipant} to a parcel. - * - * @param dest The Parcel in which the object should be written. - * @param flags Additional flags about how the object should be written. - */ - @Override - public void writeToParcel(Parcel dest, int flags) { - dest.writeParcelable(mHandle, 0); - dest.writeString(mDisplayName); - dest.writeParcelable(mEndpoint, 0); - dest.writeInt(mState); - dest.writeLong(mConnectTime); - dest.writeLong(mConnectElapsedTime); - dest.writeInt(mCallDirection); - } - - /** - * Builds a string representation of this instance. - * - * @return String representing the conference participant. - */ - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("[ConferenceParticipant Handle: "); - sb.append(Log.pii(mHandle)); - sb.append(" DisplayName: "); - sb.append(Log.pii(mDisplayName)); - sb.append(" Endpoint: "); - sb.append(Log.pii(mEndpoint)); - sb.append(" State: "); - sb.append(Connection.stateToString(mState)); - sb.append(" ConnectTime: "); - sb.append(getConnectTime()); - sb.append(" ConnectElapsedTime: "); - sb.append(getConnectElapsedTime()); - sb.append(" Direction: "); - sb.append(getCallDirection() == Call.Details.DIRECTION_INCOMING ? "Incoming" : "Outgoing"); - sb.append("]"); - return sb.toString(); - } - - /** - * The conference participant's handle (e.g., phone number). - */ - public Uri getHandle() { - return mHandle; - } - - /** - * The display name for the participant. - */ - public String getDisplayName() { - return mDisplayName; - } - - /** - * The enpoint Uri which uniquely identifies this conference participant. E.g. for an IMS - * conference call, this is the endpoint URI for the participant on the IMS conference server. - */ - public Uri getEndpoint() { - return mEndpoint; - } - - /** - * The state of the participant in the conference. - * - * @see android.telecom.Connection - */ - public int getState() { - return mState; - } - - /** - * The connect time of the participant to the conference. - */ - public long getConnectTime() { - return mConnectTime; - } - - public void setConnectTime(long connectTime) { - this.mConnectTime = connectTime; - } - - /** - * The connect elapsed time of the participant to the conference. - */ - public long getConnectElapsedTime() { - return mConnectElapsedTime; - } - - public void setConnectElapsedTime(long connectElapsedTime) { - mConnectElapsedTime = connectElapsedTime; - } - - /** - * @return The direction of the call (incoming/outgoing). - */ - public @Call.Details.CallDirection int getCallDirection() { - return mCallDirection; - } - - /** - * Sets the direction of the call. - * @param callDirection Whether the call is incoming or outgoing. - */ - public void setCallDirection(@Call.Details.CallDirection int callDirection) { - mCallDirection = callDirection; - } - - /** - * Attempts to build a tel: style URI from a conference participant. - * Conference event package data contains SIP URIs, so we try to extract the phone number and - * format into a typical tel: style URI. - * - * @param address The conference participant's address. - * @param countryIso The country ISO of the current subscription; used when formatting the - * participant phone number to E.164 format. - * @return The participant's address URI. - * @hide - */ - @VisibleForTesting - public static Uri getParticipantAddress(Uri address, String countryIso) { - if (address == null) { - return address; - } - // Even if address is already in tel: format, still parse it and rebuild. - // This is to recognize tel URIs such as: - // tel:6505551212;phone-context=ims.mnc012.mcc034.3gppnetwork.org - - // Conference event package participants are identified using SIP URIs (see RFC3261). - // A valid SIP uri has the format: sip:user:password@host:port;uri-parameters?headers - // Per RFC3261, the "user" can be a telephone number. - // For example: sip:1650555121;phone-context=blah.com@host.com - // In this case, the phone number is in the user field of the URI, and the parameters can be - // ignored. - // - // A SIP URI can also specify a phone number in a format similar to: - // sip:+1-212-555-1212@something.com;user=phone - // In this case, the phone number is again in user field and the parameters can be ignored. - // We can get the user field in these instances by splitting the string on the @, ;, or : - // and looking at the first found item. - String number = address.getSchemeSpecificPart(); - if (TextUtils.isEmpty(number)) { - return address; - } - - String numberParts[] = number.split("[@;:]"); - if (numberParts.length == 0) { - return address; - } - number = numberParts[0]; - - // Attempt to format the number in E.164 format and use that as part of the TEL URI. - // RFC2806 recommends to format telephone numbers using E.164 since it is independent of - // how the dialing of said numbers takes place. - // If conversion to E.164 fails, the returned value is null. In that case, fallback to the - // number which was in the CEP data. - String formattedNumber = null; - if (!TextUtils.isEmpty(countryIso)) { - formattedNumber = PhoneNumberUtils.formatNumberToE164(number, countryIso); - } - - return Uri.fromParts(PhoneAccount.SCHEME_TEL, - formattedNumber != null ? formattedNumber : number, null); - } -} diff --git a/telecomm/java/android/telecom/Connection.java b/telecomm/java/android/telecom/Connection.java index 20abe773e415..4c22ba9715b0 100644 --- a/telecomm/java/android/telecom/Connection.java +++ b/telecomm/java/android/telecom/Connection.java @@ -19,6 +19,7 @@ package android.telecom; import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.SystemApi; +import android.annotation.TestApi; import android.annotation.UnsupportedAppUsage; import android.app.Notification; import android.bluetooth.BluetoothDevice; @@ -274,6 +275,7 @@ public abstract class Connection extends Conferenceable { * @hide */ @SystemApi + @TestApi public static final int CAPABILITY_SPEED_UP_MT_AUDIO = 0x00040000; /** @@ -311,6 +313,7 @@ public abstract class Connection extends Conferenceable { * @hide */ @SystemApi + @TestApi public static final int CAPABILITY_CONFERENCE_HAS_NO_CHILDREN = 0x00200000; /** @@ -357,6 +360,7 @@ public abstract class Connection extends Conferenceable { * @hide */ @SystemApi + @TestApi public static final int PROPERTY_EMERGENCY_CALLBACK_MODE = 1<<0; /** @@ -367,6 +371,7 @@ public abstract class Connection extends Conferenceable { * @hide */ @SystemApi + @TestApi public static final int PROPERTY_GENERIC_CONFERENCE = 1<<1; /** @@ -418,6 +423,7 @@ public abstract class Connection extends Conferenceable { * @hide */ @SystemApi + @TestApi public static final int PROPERTY_IS_DOWNGRADED_CONFERENCE = 1<<6; /** @@ -436,7 +442,10 @@ public abstract class Connection extends Conferenceable { /** * Set by the framework to indicate that a connection is using assisted dialing. - * @hide + * <p> + * This is used for outgoing calls. + * + * @see TelecomManager#EXTRA_USE_ASSISTED_DIALING */ public static final int PROPERTY_ASSISTED_DIALING_USED = 1 << 9; @@ -458,6 +467,7 @@ public abstract class Connection extends Conferenceable { * @hide */ @SystemApi + @TestApi public static final int PROPERTY_REMOTELY_HOSTED = 1 << 11; //********************************************************************************************** @@ -516,6 +526,7 @@ public abstract class Connection extends Conferenceable { * @hide */ @SystemApi + @TestApi public static final String EXTRA_DISABLE_ADD_CALL = "android.telecom.extra.DISABLE_ADD_CALL"; @@ -1807,6 +1818,7 @@ public abstract class Connection extends Conferenceable { * @hide */ @SystemApi + @TestApi public final @Nullable String getTelecomCallId() { return mTelecomCallId; } @@ -1923,6 +1935,7 @@ public abstract class Connection extends Conferenceable { * @hide */ @SystemApi + @TestApi public final long getConnectTimeMillis() { return mConnectTimeMillis; } @@ -1942,32 +1955,12 @@ public abstract class Connection extends Conferenceable { * @hide */ @SystemApi + @TestApi public final long getConnectElapsedTimeMillis() { return mConnectElapsedTimeMillis; } /** - * Returns RIL voice radio technology used for current connection. - * <p> - * Used by the Telephony {@link ConnectionService}. - * - * @return the RIL voice radio technology used for current connection, - * see {@code RIL_RADIO_TECHNOLOGY_*} in {@link android.telephony.ServiceState}. - * - * @hide - */ - @SystemApi - public final @RilRadioTechnology int getCallRadioTech() { - int voiceNetworkType = TelephonyManager.NETWORK_TYPE_UNKNOWN; - Bundle extras = getExtras(); - if (extras != null) { - voiceNetworkType = extras.getInt(TelecomManager.EXTRA_CALL_NETWORK_TYPE, - TelephonyManager.NETWORK_TYPE_UNKNOWN); - } - return ServiceState.networkTypeToRilRadioTechnology(voiceNetworkType); - } - - /** * @return The status hints for this connection. */ public final StatusHints getStatusHints() { @@ -2045,6 +2038,7 @@ public abstract class Connection extends Conferenceable { * @hide */ @SystemApi + @TestApi public void setTelecomCallId(@NonNull String callId) { mTelecomCallId = callId; } @@ -2391,6 +2385,7 @@ public abstract class Connection extends Conferenceable { * @hide */ @SystemApi + @TestApi public final void setConnectTimeMillis(long connectTimeMillis) { mConnectTimeMillis = connectTimeMillis; } @@ -2406,39 +2401,12 @@ public abstract class Connection extends Conferenceable { * @hide */ @SystemApi + @TestApi public final void setConnectionStartElapsedRealTime(long connectElapsedTimeMillis) { mConnectElapsedTimeMillis = connectElapsedTimeMillis; } /** - * Sets RIL voice radio technology used for current connection. - * <p> - * This property is set by the Telephony {@link ConnectionService}. - * - * @param vrat the RIL Voice Radio Technology used for current connection, - * see {@code RIL_RADIO_TECHNOLOGY_*} in {@link android.telephony.ServiceState}. - * - * @hide - */ - @SystemApi - public final void setCallRadioTech(@RilRadioTechnology int vrat) { - Bundle extras = getExtras(); - if (extras == null) { - extras = new Bundle(); - } - extras.putInt(TelecomManager.EXTRA_CALL_NETWORK_TYPE, - ServiceState.rilRadioTechnologyToNetworkType(vrat)); - putExtras(extras); - // Propagates the call radio technology to its parent {@link android.telecom.Conference} - // This action only covers non-IMS CS conference calls. - // For IMS PS call conference call, it can be updated via its host connection - // {@link #Listener.onExtrasChanged} event. - if (getConference() != null) { - getConference().setCallRadioTech(vrat); - } - } - - /** * Sets the label and icon status to display in the in-call UI. * * @param statusHints The status label and icon to set. @@ -2502,6 +2470,7 @@ public abstract class Connection extends Conferenceable { * @hide */ @SystemApi + @TestApi public final void resetConnectionTime() { for (Listener l : mListeners) { l.onConnectionTimeReset(this); @@ -3246,6 +3215,7 @@ public abstract class Connection extends Conferenceable { * @hide */ @SystemApi + @TestApi public void setPhoneAccountHandle(@NonNull PhoneAccountHandle phoneAccountHandle) { if (mPhoneAccountHandle != phoneAccountHandle) { mPhoneAccountHandle = phoneAccountHandle; @@ -3264,6 +3234,7 @@ public abstract class Connection extends Conferenceable { * @hide */ @SystemApi + @TestApi public @Nullable PhoneAccountHandle getPhoneAccountHandle() { return mPhoneAccountHandle; } @@ -3329,6 +3300,7 @@ public abstract class Connection extends Conferenceable { * @hide */ @SystemApi + @TestApi public void setCallDirection(@Call.Details.CallDirection int callDirection) { mCallDirection = callDirection; } diff --git a/telecomm/java/android/telecom/ConnectionService.java b/telecomm/java/android/telecom/ConnectionService.java index 0abd9fc62b14..812b805675e5 100644 --- a/telecomm/java/android/telecom/ConnectionService.java +++ b/telecomm/java/android/telecom/ConnectionService.java @@ -16,7 +16,11 @@ package android.telecom; +import android.annotation.NonNull; +import android.annotation.Nullable; +import android.annotation.RequiresPermission; import android.annotation.SdkConstant; +import android.annotation.SystemApi; import android.app.Service; import android.content.ComponentName; import android.content.Intent; @@ -2106,15 +2110,21 @@ public abstract class ConnectionService extends Service { /** * Adds a connection created by the {@link ConnectionService} and informs telecom of the new - * connection. + * connection, as well as adding that connection to the specified conference. + * <p> + * Note: This API is intended ONLY for use by the Telephony stack to provide an easy way to add + * IMS conference participants to be added to a conference in a single step; this helps ensure + * UI updates happen atomically, rather than adding the connection and then adding it to + * the conference in another step. * * @param phoneAccountHandle The phone account handle for the connection. * @param connection The connection to add. * @param conference The parent conference of the new connection. * @hide */ - public final void addExistingConnection(PhoneAccountHandle phoneAccountHandle, - Connection connection, Conference conference) { + @SystemApi + public final void addExistingConnection(@NonNull PhoneAccountHandle phoneAccountHandle, + @NonNull Connection connection, @NonNull Conference conference) { String id = addExistingConnectionInternal(phoneAccountHandle, connection); if (id != null) { diff --git a/telecomm/java/android/telecom/PhoneAccount.java b/telecomm/java/android/telecom/PhoneAccount.java index 1b783b7beb7f..bb858cb0761b 100644 --- a/telecomm/java/android/telecom/PhoneAccount.java +++ b/telecomm/java/android/telecom/PhoneAccount.java @@ -16,7 +16,9 @@ package android.telecom; +import android.annotation.NonNull; import android.annotation.SystemApi; +import android.annotation.TestApi; import android.content.Intent; import android.graphics.drawable.Icon; import android.net.Uri; @@ -592,12 +594,17 @@ public final class PhoneAccount implements Parcelable { * only be one {@link PhoneAccount} with a non-empty group number registered to Telecom at a * time. By default, there is no group Id for a {@link PhoneAccount} (an empty String). Only * grouped {@link PhoneAccount}s with the same {@link ConnectionService} can be replaced. + * <p> + * Note: This is an API specific to the Telephony stack. + * * @param groupId The group Id of the {@link PhoneAccount} that will replace any other * registered {@link PhoneAccount} in Telecom with the same Group Id. * @return The builder * @hide */ - public Builder setGroupId(String groupId) { + @SystemApi + @TestApi + public @NonNull Builder setGroupId(@NonNull String groupId) { if (groupId != null) { mGroupId = groupId; } else { diff --git a/telecomm/java/android/telecom/TelecomManager.java b/telecomm/java/android/telecom/TelecomManager.java index 625cd72542dd..4016943d9c2c 100644 --- a/telecomm/java/android/telecom/TelecomManager.java +++ b/telecomm/java/android/telecom/TelecomManager.java @@ -14,6 +14,8 @@ package android.telecom; +import static android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE; + import android.Manifest; import android.annotation.IntDef; import android.annotation.NonNull; @@ -697,7 +699,17 @@ public class TelecomManager { /** * The boolean indicated by this extra controls whether or not a call is eligible to undergo * assisted dialing. This extra is stored under {@link #EXTRA_OUTGOING_CALL_EXTRAS}. - * @hide + * <p> + * The call initiator can use this extra to indicate that a call used assisted dialing to help + * place the call. This is most commonly used by a Dialer app which provides the ability to + * automatically add dialing prefixes when placing international calls. + * <p> + * Setting this extra on the outgoing call extras will cause the + * {@link Connection#PROPERTY_ASSISTED_DIALING_USED} property and + * {@link Call.Details#PROPERTY_ASSISTED_DIALING_USED} property to be set on the + * {@link Connection}/{@link Call} in question. When the call is logged to the call log, the + * {@link android.provider.CallLog.Calls#FEATURES_ASSISTED_DIALING_USED} call feature is set to + * indicate that assisted dialing was used for the call. */ public static final String EXTRA_USE_ASSISTED_DIALING = "android.telecom.extra.USE_ASSISTED_DIALING"; @@ -739,6 +751,14 @@ public class TelecomManager { */ public static final int PRESENTATION_PAYPHONE = 4; + /** @hide */ + @Retention(RetentionPolicy.SOURCE) + @IntDef( + prefix = { "PRESENTATION_" }, + value = {PRESENTATION_ALLOWED, PRESENTATION_RESTRICTED, PRESENTATION_UNKNOWN, + PRESENTATION_PAYPHONE}) + public @interface Presentation {} + private static final String TAG = "TelecomManager"; private final Context mContext; @@ -884,9 +904,8 @@ public class TelecomManager { * queried for. * @return The phone account handle of the current sim call manager. * @see SubscriptionManager#getActiveSubscriptionInfoList() - * @hide */ - public PhoneAccountHandle getSimCallManagerForSubscription(int subscriptionId) { + public @Nullable PhoneAccountHandle getSimCallManagerForSubscription(int subscriptionId) { try { if (isServiceConnected()) { return getTelecomService().getSimCallManager(subscriptionId); @@ -948,7 +967,7 @@ public class TelecomManager { */ @SystemApi @RequiresPermission(anyOf = { - android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE, + READ_PRIVILEGED_PHONE_STATE, android.Manifest.permission.READ_PHONE_STATE }) public List<PhoneAccountHandle> getPhoneAccountsSupportingScheme(String uriScheme) { @@ -1235,6 +1254,28 @@ public class TelecomManager { } /** + * Used to determine the currently selected default dialer package for a specific user. + * + * @param userId the user id to query the default dialer package for. + * @return package name for the default dialer package or null if no package has been + * selected as the default dialer. + * @hide + */ + @SystemApi + @TestApi + @RequiresPermission(READ_PRIVILEGED_PHONE_STATE) + public @Nullable String getDefaultDialerPackage(int userId) { + try { + if (isServiceConnected()) { + return getTelecomService().getDefaultDialerPackageForUser(userId); + } + } catch (RemoteException e) { + Log.e(TAG, "RemoteException attempting to get the default dialer package name.", e); + } + return null; + } + + /** * Used to set the default dialer package. * * @param packageName to set the default dialer to, or {@code null} if the system provided @@ -1433,7 +1474,7 @@ public class TelecomManager { */ @SystemApi @RequiresPermission(anyOf = { - android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE, + READ_PRIVILEGED_PHONE_STATE, android.Manifest.permission.READ_PHONE_STATE }) public boolean isRinging() { @@ -1563,7 +1604,7 @@ public class TelecomManager { * Returns whether TTY is supported on this device. */ @RequiresPermission(anyOf = { - android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE, + READ_PRIVILEGED_PHONE_STATE, android.Manifest.permission.READ_PHONE_STATE }) public boolean isTtySupported() { @@ -1589,7 +1630,7 @@ public class TelecomManager { */ @SystemApi @TestApi - @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) + @RequiresPermission(READ_PRIVILEGED_PHONE_STATE) public @TtyMode int getCurrentTtyMode() { try { if (isServiceConnected()) { diff --git a/telecomm/java/com/android/internal/telecom/ITelecomService.aidl b/telecomm/java/com/android/internal/telecom/ITelecomService.aidl index 24119885a119..de3a816eba03 100644 --- a/telecomm/java/com/android/internal/telecom/ITelecomService.aidl +++ b/telecomm/java/com/android/internal/telecom/ITelecomService.aidl @@ -146,6 +146,11 @@ interface ITelecomService { String getDefaultDialerPackage(); /** + * @see TelecomServiceImpl#getDefaultDialerPackage + */ + String getDefaultDialerPackageForUser(int userId); + + /** * @see TelecomServiceImpl#getSystemDialerPackage */ String getSystemDialerPackage(); diff --git a/telephony/java/android/telephony/ims/ImsConferenceState.java b/telephony/java/android/telephony/ims/ImsConferenceState.java index eb6c12cb73e2..8d2049b97138 100644 --- a/telephony/java/android/telephony/ims/ImsConferenceState.java +++ b/telephony/java/android/telephony/ims/ImsConferenceState.java @@ -24,7 +24,8 @@ import android.os.Parcel; import android.os.Parcelable; import android.telecom.Call; import android.telecom.Connection; -import android.telecom.Log; +import android.telephony.Rlog; +import android.util.Log; import java.util.HashMap; import java.util.Iterator; @@ -39,6 +40,7 @@ import java.util.Set; @SystemApi @TestApi public final class ImsConferenceState implements Parcelable { + private static final String TAG = "ImsConferenceState"; /** * conference-info : user */ @@ -194,7 +196,7 @@ public final class ImsConferenceState implements Parcelable { sb.append("<"); while (iterator.hasNext()) { Entry<String, Bundle> entry = iterator.next(); - sb.append(Log.pii(entry.getKey())); + sb.append(Rlog.pii(TAG, entry.getKey())); sb.append(": "); Bundle participantData = entry.getValue(); @@ -202,7 +204,7 @@ public final class ImsConferenceState implements Parcelable { sb.append(key); sb.append("="); if (ENDPOINT.equals(key) || USER.equals(key)) { - sb.append(Log.pii(participantData.get(key))); + sb.append(Rlog.pii(TAG, participantData.get(key))); } else { sb.append(participantData.get(key)); } diff --git a/telephony/java/android/telephony/ims/ImsExternalCallState.java b/telephony/java/android/telephony/ims/ImsExternalCallState.java index 177d9b3343f0..dcb9c9d5ec27 100644 --- a/telephony/java/android/telephony/ims/ImsExternalCallState.java +++ b/telephony/java/android/telephony/ims/ImsExternalCallState.java @@ -24,7 +24,6 @@ import android.annotation.TestApi; import android.net.Uri; import android.os.Parcel; import android.os.Parcelable; -import android.telecom.Log; import android.telephony.Rlog; import java.lang.annotation.Retention; @@ -219,8 +218,8 @@ public final class ImsExternalCallState implements Parcelable { @Override public String toString() { return "ImsExternalCallState { mCallId = " + mCallId + - ", mAddress = " + Log.pii(mAddress) + - ", mLocalAddress = " + Log.pii(mLocalAddress) + + ", mAddress = " + Rlog.pii(TAG, mAddress) + + ", mLocalAddress = " + Rlog.pii(TAG, mLocalAddress) + ", mIsPullable = " + mIsPullable + ", mCallState = " + mCallState + ", mCallType = " + mCallType + |