Loading src/com/android/server/telecom/RoleManagerAdapter.java +15 −0 Original line number Diff line number Diff line Loading @@ -25,6 +25,21 @@ import java.util.List; * and remove direct dependencies. */ public interface RoleManagerAdapter { /** * Returns the package name of the app which fills the {@link android.app.role.RoleManager} call * redirection role. * @return the package name of the app filling the role, {@code null} otherwise}. */ String getDefaultCallRedirectionApp(); /** * Override the {@link android.app.role.RoleManager} call redirection app with another value. * Used for testing purposes only. * @param packageName Package name of the app to fill the call redirection role. Where * {@code null}, the override is removed. */ void setTestDefaultCallRedirectionApp(String packageName); /** * Returns the package name of the app which fills the {@link android.app.role.RoleManager} call * screening role. Loading src/com/android/server/telecom/RoleManagerAdapterImpl.java +30 −0 Original line number Diff line number Diff line Loading @@ -26,6 +26,8 @@ import java.util.List; import java.util.stream.Collectors; public class RoleManagerAdapterImpl implements RoleManagerAdapter { // TODO: replace with actual role manager const. private static final String ROLE_CALL_REDIRECTION = "android.app.role.PROXY_CALLING_APP"; // TODO: replace with actual role manager const. private static final String ROLE_CAR_MODE_DIALER = "android.app.role.ROLE_CAR_MODE_DIALER"; // TODO: replace with actual role manager const. Loading @@ -34,6 +36,7 @@ public class RoleManagerAdapterImpl implements RoleManagerAdapter { private static final String ROLE_CALL_COMPANION_APP = "android.app.role.ROLE_CALL_COMPANION_APP"; private String mOverrideDefaultCallRedirectionApp = null; private String mOverrideDefaultCallScreeningApp = null; private String mOverrideDefaultCarModeApp = null; private List<String> mOverrideCallCompanionApps = new ArrayList<>(); Loading @@ -42,6 +45,19 @@ public class RoleManagerAdapterImpl implements RoleManagerAdapter { public RoleManagerAdapterImpl() { } @Override public String getDefaultCallRedirectionApp() { if (mOverrideDefaultCallRedirectionApp != null) { return mOverrideDefaultCallRedirectionApp; } return getRoleManagerCallRedirectionApp(); } @Override public void setTestDefaultCallRedirectionApp(String packageName) { mOverrideDefaultCallRedirectionApp = packageName; } @Override public String getDefaultCallScreeningApp() { if (mOverrideDefaultCallScreeningApp != null) { Loading Loading @@ -89,6 +105,11 @@ public class RoleManagerAdapterImpl implements RoleManagerAdapter { mCurrentUserHandle = currentUserHandle; } private String getRoleManagerCallRedirectionApp() { // TODO: Link in RoleManager return null; } private String getRoleManagerCallScreeningApp() { // TODO: Link in RoleManager return null; Loading @@ -110,6 +131,15 @@ public class RoleManagerAdapterImpl implements RoleManagerAdapter { * @param pw The {@code IndentingPrintWriter} to write the state to. */ public void dump(IndentingPrintWriter pw) { pw.print("DefaultCallRedirectionApp: "); if (mOverrideDefaultCallRedirectionApp != null) { pw.print("(override "); pw.print(mOverrideDefaultCallRedirectionApp); pw.print(") "); pw.print(getRoleManagerCallRedirectionApp()); } pw.println(); pw.print("DefaultCallScreeningApp: "); if (mOverrideDefaultCallScreeningApp != null) { pw.print("(override "); Loading src/com/android/server/telecom/TelecomServiceImpl.java +22 −0 Original line number Diff line number Diff line Loading @@ -1668,6 +1668,28 @@ public class TelecomServiceImpl { } } @Override public void setTestDefaultCallRedirectionApp(String packageName) { try { Log.startSession("TSI.sTDCRA"); enforceModifyPermission(); if (!Build.IS_USERDEBUG) { throw new SecurityException("Test-only API."); } synchronized (mLock) { long token = Binder.clearCallingIdentity(); try { mCallsManager.getRoleManagerAdapter().setTestDefaultCallRedirectionApp( packageName); } finally { Binder.restoreCallingIdentity(token); } } } finally { Log.endSession(); } } @Override public void setTestDefaultCallScreeningApp(String packageName) { try { Loading Loading
src/com/android/server/telecom/RoleManagerAdapter.java +15 −0 Original line number Diff line number Diff line Loading @@ -25,6 +25,21 @@ import java.util.List; * and remove direct dependencies. */ public interface RoleManagerAdapter { /** * Returns the package name of the app which fills the {@link android.app.role.RoleManager} call * redirection role. * @return the package name of the app filling the role, {@code null} otherwise}. */ String getDefaultCallRedirectionApp(); /** * Override the {@link android.app.role.RoleManager} call redirection app with another value. * Used for testing purposes only. * @param packageName Package name of the app to fill the call redirection role. Where * {@code null}, the override is removed. */ void setTestDefaultCallRedirectionApp(String packageName); /** * Returns the package name of the app which fills the {@link android.app.role.RoleManager} call * screening role. Loading
src/com/android/server/telecom/RoleManagerAdapterImpl.java +30 −0 Original line number Diff line number Diff line Loading @@ -26,6 +26,8 @@ import java.util.List; import java.util.stream.Collectors; public class RoleManagerAdapterImpl implements RoleManagerAdapter { // TODO: replace with actual role manager const. private static final String ROLE_CALL_REDIRECTION = "android.app.role.PROXY_CALLING_APP"; // TODO: replace with actual role manager const. private static final String ROLE_CAR_MODE_DIALER = "android.app.role.ROLE_CAR_MODE_DIALER"; // TODO: replace with actual role manager const. Loading @@ -34,6 +36,7 @@ public class RoleManagerAdapterImpl implements RoleManagerAdapter { private static final String ROLE_CALL_COMPANION_APP = "android.app.role.ROLE_CALL_COMPANION_APP"; private String mOverrideDefaultCallRedirectionApp = null; private String mOverrideDefaultCallScreeningApp = null; private String mOverrideDefaultCarModeApp = null; private List<String> mOverrideCallCompanionApps = new ArrayList<>(); Loading @@ -42,6 +45,19 @@ public class RoleManagerAdapterImpl implements RoleManagerAdapter { public RoleManagerAdapterImpl() { } @Override public String getDefaultCallRedirectionApp() { if (mOverrideDefaultCallRedirectionApp != null) { return mOverrideDefaultCallRedirectionApp; } return getRoleManagerCallRedirectionApp(); } @Override public void setTestDefaultCallRedirectionApp(String packageName) { mOverrideDefaultCallRedirectionApp = packageName; } @Override public String getDefaultCallScreeningApp() { if (mOverrideDefaultCallScreeningApp != null) { Loading Loading @@ -89,6 +105,11 @@ public class RoleManagerAdapterImpl implements RoleManagerAdapter { mCurrentUserHandle = currentUserHandle; } private String getRoleManagerCallRedirectionApp() { // TODO: Link in RoleManager return null; } private String getRoleManagerCallScreeningApp() { // TODO: Link in RoleManager return null; Loading @@ -110,6 +131,15 @@ public class RoleManagerAdapterImpl implements RoleManagerAdapter { * @param pw The {@code IndentingPrintWriter} to write the state to. */ public void dump(IndentingPrintWriter pw) { pw.print("DefaultCallRedirectionApp: "); if (mOverrideDefaultCallRedirectionApp != null) { pw.print("(override "); pw.print(mOverrideDefaultCallRedirectionApp); pw.print(") "); pw.print(getRoleManagerCallRedirectionApp()); } pw.println(); pw.print("DefaultCallScreeningApp: "); if (mOverrideDefaultCallScreeningApp != null) { pw.print("(override "); Loading
src/com/android/server/telecom/TelecomServiceImpl.java +22 −0 Original line number Diff line number Diff line Loading @@ -1668,6 +1668,28 @@ public class TelecomServiceImpl { } } @Override public void setTestDefaultCallRedirectionApp(String packageName) { try { Log.startSession("TSI.sTDCRA"); enforceModifyPermission(); if (!Build.IS_USERDEBUG) { throw new SecurityException("Test-only API."); } synchronized (mLock) { long token = Binder.clearCallingIdentity(); try { mCallsManager.getRoleManagerAdapter().setTestDefaultCallRedirectionApp( packageName); } finally { Binder.restoreCallingIdentity(token); } } } finally { Log.endSession(); } } @Override public void setTestDefaultCallScreeningApp(String packageName) { try { Loading