Loading src/com/android/settings/applications/specialaccess/interactacrossprofiles/InteractAcrossProfilesDetails.java +25 −6 Original line number Diff line number Diff line Loading @@ -32,6 +32,7 @@ import static android.provider.Settings.Global.CONNECTED_APPS_ALLOWED_PACKAGES; import static android.provider.Settings.Global.CONNECTED_APPS_DISALLOWED_PACKAGES; import android.Manifest; import android.annotation.Nullable; import android.annotation.UserIdInt; import android.app.ActionBar; import android.app.AppOpsManager; Loading Loading @@ -107,6 +108,8 @@ public class InteractAcrossProfilesDetails extends AppInfoBase private String mAppLabel; private Intent mInstallAppIntent; private boolean mIsPageLaunchedByApp; @Nullable private AlertDialog mDialog = null; @Override public void onCreate(Bundle savedInstanceState) { Loading Loading @@ -307,6 +310,9 @@ public class InteractAcrossProfilesDetails extends AppInfoBase } private void showConsentDialog() { if (mDialog != null && mDialog.isShowing()) { mDialog.dismiss(); } final View dialogView = getLayoutInflater().inflate( R.layout.interact_across_profiles_consent_dialog, null); Loading Loading @@ -343,13 +349,14 @@ public class InteractAcrossProfilesDetails extends AppInfoBase } AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); builder.setView(dialogView) mDialog = builder.setView(dialogView) .setPositiveButton(R.string.allow, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { logEvent(DevicePolicyEnums.CROSS_PROFILE_SETTINGS_PAGE_USER_CONSENTED); enableInteractAcrossProfiles(true); refreshUi(); if (mIsPageLaunchedByApp) { dialog.dismiss(); setIntentAndFinish(/* appChanged= */ true); } } Loading @@ -361,7 +368,8 @@ public class InteractAcrossProfilesDetails extends AppInfoBase refreshUi(); } }) .create().show(); .create(); mDialog.show(); } private boolean isInteractAcrossProfilesEnabled() { Loading Loading @@ -536,7 +544,8 @@ public class InteractAcrossProfilesDetails extends AppInfoBase mSwitchPref.setChecked(true); mSwitchPref.setTitle(R.string.interact_across_profiles_switch_enabled); final ImageView horizontalArrowIcon = mHeader.findViewById(com.android.settingslib.widget.preference.layout.R.id.entity_header_swap_horiz); mHeader.findViewById( com.android.settingslib.widget.preference.layout.R.id.entity_header_swap_horiz); if (horizontalArrowIcon != null) { horizontalArrowIcon.setImageDrawable( mContext.getDrawable( Loading @@ -548,7 +557,8 @@ public class InteractAcrossProfilesDetails extends AppInfoBase mSwitchPref.setChecked(false); mSwitchPref.setTitle(R.string.interact_across_profiles_switch_disabled); final ImageView horizontalArrowIcon = mHeader.findViewById(com.android.settingslib.widget.preference.layout.R.id.entity_header_swap_horiz); mHeader.findViewById( com.android.settingslib.widget.preference.layout.R.id.entity_header_swap_horiz); if (horizontalArrowIcon != null) { horizontalArrowIcon.setImageDrawable( mContext.getDrawable( Loading @@ -556,6 +566,15 @@ public class InteractAcrossProfilesDetails extends AppInfoBase } } @Override public void onDestroy() { if (mDialog != null) { mDialog.dismiss(); } mDialog = null; super.onDestroy(); } @Override protected AlertDialog createDialog(int id, int errorCode) { return null; Loading Loading
src/com/android/settings/applications/specialaccess/interactacrossprofiles/InteractAcrossProfilesDetails.java +25 −6 Original line number Diff line number Diff line Loading @@ -32,6 +32,7 @@ import static android.provider.Settings.Global.CONNECTED_APPS_ALLOWED_PACKAGES; import static android.provider.Settings.Global.CONNECTED_APPS_DISALLOWED_PACKAGES; import android.Manifest; import android.annotation.Nullable; import android.annotation.UserIdInt; import android.app.ActionBar; import android.app.AppOpsManager; Loading Loading @@ -107,6 +108,8 @@ public class InteractAcrossProfilesDetails extends AppInfoBase private String mAppLabel; private Intent mInstallAppIntent; private boolean mIsPageLaunchedByApp; @Nullable private AlertDialog mDialog = null; @Override public void onCreate(Bundle savedInstanceState) { Loading Loading @@ -307,6 +310,9 @@ public class InteractAcrossProfilesDetails extends AppInfoBase } private void showConsentDialog() { if (mDialog != null && mDialog.isShowing()) { mDialog.dismiss(); } final View dialogView = getLayoutInflater().inflate( R.layout.interact_across_profiles_consent_dialog, null); Loading Loading @@ -343,13 +349,14 @@ public class InteractAcrossProfilesDetails extends AppInfoBase } AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); builder.setView(dialogView) mDialog = builder.setView(dialogView) .setPositiveButton(R.string.allow, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { logEvent(DevicePolicyEnums.CROSS_PROFILE_SETTINGS_PAGE_USER_CONSENTED); enableInteractAcrossProfiles(true); refreshUi(); if (mIsPageLaunchedByApp) { dialog.dismiss(); setIntentAndFinish(/* appChanged= */ true); } } Loading @@ -361,7 +368,8 @@ public class InteractAcrossProfilesDetails extends AppInfoBase refreshUi(); } }) .create().show(); .create(); mDialog.show(); } private boolean isInteractAcrossProfilesEnabled() { Loading Loading @@ -536,7 +544,8 @@ public class InteractAcrossProfilesDetails extends AppInfoBase mSwitchPref.setChecked(true); mSwitchPref.setTitle(R.string.interact_across_profiles_switch_enabled); final ImageView horizontalArrowIcon = mHeader.findViewById(com.android.settingslib.widget.preference.layout.R.id.entity_header_swap_horiz); mHeader.findViewById( com.android.settingslib.widget.preference.layout.R.id.entity_header_swap_horiz); if (horizontalArrowIcon != null) { horizontalArrowIcon.setImageDrawable( mContext.getDrawable( Loading @@ -548,7 +557,8 @@ public class InteractAcrossProfilesDetails extends AppInfoBase mSwitchPref.setChecked(false); mSwitchPref.setTitle(R.string.interact_across_profiles_switch_disabled); final ImageView horizontalArrowIcon = mHeader.findViewById(com.android.settingslib.widget.preference.layout.R.id.entity_header_swap_horiz); mHeader.findViewById( com.android.settingslib.widget.preference.layout.R.id.entity_header_swap_horiz); if (horizontalArrowIcon != null) { horizontalArrowIcon.setImageDrawable( mContext.getDrawable( Loading @@ -556,6 +566,15 @@ public class InteractAcrossProfilesDetails extends AppInfoBase } } @Override public void onDestroy() { if (mDialog != null) { mDialog.dismiss(); } mDialog = null; super.onDestroy(); } @Override protected AlertDialog createDialog(int id, int errorCode) { return null; Loading