Merge "Show status bar in CarUserSwitchingDialog." into rvc-dev am: db3c760032
Change-Id: If75f9c86e121f2ec8a531d8ebd453bb629a74ca4
This commit is contained in:
@@ -35,6 +35,8 @@ import android.os.UserManager;
|
|||||||
import android.provider.Settings;
|
import android.provider.Settings;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
import android.view.WindowInsets;
|
||||||
|
import android.view.WindowManager;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
@@ -50,12 +52,19 @@ import com.android.internal.R;
|
|||||||
final class CarUserSwitchingDialog extends UserSwitchingDialog {
|
final class CarUserSwitchingDialog extends UserSwitchingDialog {
|
||||||
|
|
||||||
private static final String TAG = "ActivityManagerCarUserSwitchingDialog";
|
private static final String TAG = "ActivityManagerCarUserSwitchingDialog";
|
||||||
|
private View mView;
|
||||||
|
|
||||||
public CarUserSwitchingDialog(ActivityManagerService service, Context context, UserInfo oldUser,
|
public CarUserSwitchingDialog(ActivityManagerService service, Context context, UserInfo oldUser,
|
||||||
UserInfo newUser, boolean aboveSystem, String switchingFromSystemUserMessage,
|
UserInfo newUser, boolean aboveSystem, String switchingFromSystemUserMessage,
|
||||||
String switchingToSystemUserMessage) {
|
String switchingToSystemUserMessage) {
|
||||||
super(service, context, oldUser, newUser, aboveSystem, switchingFromSystemUserMessage,
|
super(service, context, oldUser, newUser, aboveSystem, switchingFromSystemUserMessage,
|
||||||
switchingToSystemUserMessage);
|
switchingToSystemUserMessage);
|
||||||
|
|
||||||
|
// {@link UserSwitchingDialog} uses {@link WindowManager.LayoutParams.TYPE_SYSTEM_ERROR}
|
||||||
|
// when trying to show dialog above system. That window type has been deprecated and since
|
||||||
|
// this is a system dialog, hence, it makes sense to put this in System Dialog Window.
|
||||||
|
// This window also automatically shows status bar.
|
||||||
|
getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_DIALOG);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -65,7 +74,7 @@ final class CarUserSwitchingDialog extends UserSwitchingDialog {
|
|||||||
Resources res = getContext().getResources();
|
Resources res = getContext().getResources();
|
||||||
// Custom view due to alignment and font size requirements
|
// Custom view due to alignment and font size requirements
|
||||||
getContext().setTheme(R.style.Theme_DeviceDefault_Light_Dialog_Alert_UserSwitchingDialog);
|
getContext().setTheme(R.style.Theme_DeviceDefault_Light_Dialog_Alert_UserSwitchingDialog);
|
||||||
View view = LayoutInflater.from(getContext()).inflate(
|
mView = LayoutInflater.from(getContext()).inflate(
|
||||||
R.layout.car_user_switching_dialog,
|
R.layout.car_user_switching_dialog,
|
||||||
null);
|
null);
|
||||||
|
|
||||||
@@ -75,11 +84,11 @@ final class CarUserSwitchingDialog extends UserSwitchingDialog {
|
|||||||
if (bitmap != null) {
|
if (bitmap != null) {
|
||||||
CircleFramedDrawable drawable = CircleFramedDrawable.getInstance(bitmap,
|
CircleFramedDrawable drawable = CircleFramedDrawable.getInstance(bitmap,
|
||||||
res.getDimension(R.dimen.car_fullscreen_user_pod_image_avatar_height));
|
res.getDimension(R.dimen.car_fullscreen_user_pod_image_avatar_height));
|
||||||
((ImageView) view.findViewById(R.id.user_loading_avatar))
|
((ImageView) mView.findViewById(R.id.user_loading_avatar))
|
||||||
.setImageDrawable(drawable);
|
.setImageDrawable(drawable);
|
||||||
}
|
}
|
||||||
|
|
||||||
TextView msgView = view.findViewById(R.id.user_loading);
|
TextView msgView = mView.findViewById(R.id.user_loading);
|
||||||
|
|
||||||
// TODO(b/145132885): use constant from CarSettings
|
// TODO(b/145132885): use constant from CarSettings
|
||||||
boolean showInfo = "true".equals(Settings.Global.getString(
|
boolean showInfo = "true".equals(Settings.Global.getString(
|
||||||
@@ -92,7 +101,17 @@ final class CarUserSwitchingDialog extends UserSwitchingDialog {
|
|||||||
} else {
|
} else {
|
||||||
msgView.setText(res.getString(R.string.car_loading_profile));
|
msgView.setText(res.getString(R.string.car_loading_profile));
|
||||||
}
|
}
|
||||||
setView(view);
|
setView(mView);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void show() {
|
||||||
|
super.show();
|
||||||
|
hideNavigationBar();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void hideNavigationBar() {
|
||||||
|
mView.getWindowInsetsController().hide(WindowInsets.Type.navigationBars());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user