Change strings in MiniResolver to use dynamo
Test: manually tested Bug: 268470040 Change-Id: I30aaee51358f1acb32a73fb31e30c7b553f68687
This commit is contained in:
@@ -1857,6 +1857,17 @@ public final class DevicePolicyResources {
|
||||
public static final String WORK_PROFILE_TELEPHONY_PAUSED_TURN_ON_BUTTON =
|
||||
PREFIX + "TURN_ON_WORK_PROFILE_BUTTON_TEXT";
|
||||
|
||||
public static final String MINIRESOLVER_OPEN_IN_WORK =
|
||||
PREFIX + "MINIRESOLVER_OPEN_IN_WORK";
|
||||
|
||||
public static final String MINIRESOLVER_OPEN_IN_PERSONAL =
|
||||
PREFIX + "MINIRESOLVER_OPEN_IN_PERSONAL";
|
||||
|
||||
public static final String MINIRESOLVER_USE_WORK_BROWSER =
|
||||
PREFIX + "MINIRESOLVER_OPEN_IN_PERSONAL";
|
||||
|
||||
public static final String MINIRESOLVER_USE_PERSONAL_BROWSER =
|
||||
PREFIX + "MINIRESOLVER_OPEN_IN_PERSONAL";
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -18,6 +18,7 @@ package com.android.internal.app;
|
||||
|
||||
import static android.app.admin.DevicePolicyResources.Strings.Core.FORWARD_INTENT_TO_PERSONAL;
|
||||
import static android.app.admin.DevicePolicyResources.Strings.Core.FORWARD_INTENT_TO_WORK;
|
||||
import static android.app.admin.DevicePolicyResources.Strings.Core.MINIRESOLVER_OPEN_IN_WORK;
|
||||
import static android.content.pm.PackageManager.MATCH_DEFAULT_ONLY;
|
||||
|
||||
import static com.android.internal.app.ResolverActivity.EXTRA_CALLING_USER;
|
||||
@@ -196,9 +197,7 @@ public class IntentForwarderActivity extends Activity {
|
||||
buttonContainer.setPadding(0, 0, 0, buttonContainer.getPaddingBottom());
|
||||
|
||||
((TextView) findViewById(R.id.open_cross_profile)).setText(
|
||||
getResources().getString(
|
||||
R.string.miniresolver_open_in_work,
|
||||
target.loadLabel(packageManagerForTargetUser)));
|
||||
getOpenInWorkMessage(target.loadLabel(packageManagerForTargetUser)));
|
||||
|
||||
// The mini-resolver's negative button is reused in this flow to cancel the intent
|
||||
((Button) findViewById(R.id.use_same_profile_browser)).setText(R.string.cancel);
|
||||
@@ -210,6 +209,13 @@ public class IntentForwarderActivity extends Activity {
|
||||
});
|
||||
}
|
||||
|
||||
private String getOpenInWorkMessage(CharSequence targetLabel) {
|
||||
return getSystemService(DevicePolicyManager.class).getResources().getString(
|
||||
MINIRESOLVER_OPEN_IN_WORK,
|
||||
() -> getString(R.string.miniresolver_open_in_work, targetLabel),
|
||||
targetLabel);
|
||||
}
|
||||
|
||||
private String getForwardToPersonalMessage() {
|
||||
return getSystemService(DevicePolicyManager.class).getResources().getString(
|
||||
FORWARD_INTENT_TO_PERSONAL,
|
||||
|
||||
@@ -19,6 +19,10 @@ package com.android.internal.app;
|
||||
import static android.Manifest.permission.INTERACT_ACROSS_PROFILES;
|
||||
import static android.app.admin.DevicePolicyResources.Strings.Core.FORWARD_INTENT_TO_PERSONAL;
|
||||
import static android.app.admin.DevicePolicyResources.Strings.Core.FORWARD_INTENT_TO_WORK;
|
||||
import static android.app.admin.DevicePolicyResources.Strings.Core.MINIRESOLVER_OPEN_IN_PERSONAL;
|
||||
import static android.app.admin.DevicePolicyResources.Strings.Core.MINIRESOLVER_OPEN_IN_WORK;
|
||||
import static android.app.admin.DevicePolicyResources.Strings.Core.MINIRESOLVER_USE_PERSONAL_BROWSER;
|
||||
import static android.app.admin.DevicePolicyResources.Strings.Core.MINIRESOLVER_USE_WORK_BROWSER;
|
||||
import static android.app.admin.DevicePolicyResources.Strings.Core.RESOLVER_CANT_ACCESS_PERSONAL;
|
||||
import static android.app.admin.DevicePolicyResources.Strings.Core.RESOLVER_CANT_ACCESS_WORK;
|
||||
import static android.app.admin.DevicePolicyResources.Strings.Core.RESOLVER_CROSS_PROFILE_BLOCKED_TITLE;
|
||||
@@ -46,6 +50,7 @@ import android.app.VoiceInteractor.PickOptionRequest.Option;
|
||||
import android.app.VoiceInteractor.Prompt;
|
||||
import android.app.admin.DevicePolicyEventLogger;
|
||||
import android.app.admin.DevicePolicyManager;
|
||||
import android.app.admin.DevicePolicyResourcesManager;
|
||||
import android.compat.annotation.UnsupportedAppUsage;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.ComponentName;
|
||||
@@ -1713,14 +1718,29 @@ public class ResolverActivity extends Activity implements
|
||||
}
|
||||
}.execute();
|
||||
|
||||
((TextView) findViewById(R.id.open_cross_profile)).setText(
|
||||
getResources().getString(
|
||||
inWorkProfile ? R.string.miniresolver_open_in_personal
|
||||
: R.string.miniresolver_open_in_work,
|
||||
otherProfileResolveInfo.getDisplayLabel()));
|
||||
((Button) findViewById(R.id.use_same_profile_browser)).setText(
|
||||
inWorkProfile ? R.string.miniresolver_use_work_browser
|
||||
: R.string.miniresolver_use_personal_browser);
|
||||
CharSequence targetDisplayLabel = otherProfileResolveInfo.getDisplayLabel();
|
||||
|
||||
DevicePolicyResourcesManager devicePolicyResourcesManager = getSystemService(
|
||||
DevicePolicyManager.class).getResources();
|
||||
|
||||
if (inWorkProfile) {
|
||||
((TextView) findViewById(R.id.open_cross_profile)).setText(
|
||||
devicePolicyResourcesManager.getString(MINIRESOLVER_OPEN_IN_WORK,
|
||||
() -> getString(R.string.miniresolver_open_in_work, targetDisplayLabel),
|
||||
targetDisplayLabel));
|
||||
((Button) findViewById(R.id.use_same_profile_browser)).setText(
|
||||
devicePolicyResourcesManager.getString(MINIRESOLVER_USE_WORK_BROWSER,
|
||||
() -> getString(R.string.miniresolver_use_work_browser)));
|
||||
} else {
|
||||
((TextView) findViewById(R.id.open_cross_profile)).setText(
|
||||
devicePolicyResourcesManager.getString(MINIRESOLVER_OPEN_IN_PERSONAL,
|
||||
() -> getString(R.string.miniresolver_open_in_personal,
|
||||
targetDisplayLabel),
|
||||
targetDisplayLabel));
|
||||
((Button) findViewById(R.id.use_same_profile_browser)).setText(
|
||||
devicePolicyResourcesManager.getString(MINIRESOLVER_USE_PERSONAL_BROWSER,
|
||||
() -> getString(R.string.miniresolver_use_personal_browser)));
|
||||
}
|
||||
|
||||
findViewById(R.id.use_same_profile_browser).setOnClickListener(
|
||||
v -> {
|
||||
|
||||
Reference in New Issue
Block a user