Adding option in global setting to control the display message during user switch

Bug: 145915635
Bug: 145132885
Test: adb shell settings put global android.car.ENABLE_USER_SWITCH_DEVELOPER_MESSAGE true
Merged-In: I70c72d7d74c72a78d919ae34906b6f7b96466ad1
Change-Id: I70c72d7d74c72a78d919ae34906b6f7b96466ad1
(cherry picked from commit e12de0beb4)
This commit is contained in:
Mayank Garg
2020-01-10 00:47:08 -08:00
committed by Felipe Leme
parent 9ab9aa4c96
commit a9feb4602f

View File

@@ -33,6 +33,7 @@ import android.graphics.RectF;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.os.UserManager;
import android.provider.Settings;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;
@@ -81,8 +82,19 @@ final class CarUserSwitchingDialog extends UserSwitchingDialog {
.setImageDrawable(drawable);
}
((TextView) view.findViewById(R.id.user_loading))
.setText(res.getString(R.string.car_loading_profile));
TextView msgView = view.findViewById(R.id.user_loading);
// TODO(b/145132885): use constant from CarSettings
boolean showInfo = "true".equals(Settings.Global.getString(
getContext().getContentResolver(),
"android.car.ENABLE_USER_SWITCH_DEVELOPER_MESSAGE"));
if (showInfo) {
msgView.setText(res.getString(R.string.car_loading_profile) + " user\n(from "
+ mOldUser.id + " to " + mNewUser.id + ")");
} else {
msgView.setText(res.getString(R.string.car_loading_profile));
}
setView(view);
}