Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5b8e5a7d authored by Amith Yamasani's avatar Amith Yamasani Committed by Android (Google) Code Review
Browse files

Merge "Improve user switching interstitial" into lmp-dev

parents 6b241649 c2a8d151
Loading
Loading
Loading
Loading
+27 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
     Copyright (C) 2014 The Android Open Source Project

     Licensed under the Apache License, Version 2.0 (the "License");
     you may not use this file except in compliance with the License.
     You may obtain a copy of the License at

          http://www.apache.org/licenses/LICENSE-2.0

     Unless required by applicable law or agreed to in writing, software
     distributed under the License is distributed on an "AS IS" BASIS,
     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     See the License for the specific language governing permissions and
     limitations under the License.
-->

<TextView xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/message"
        style="?attr/textAppearanceListItem"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:gravity="center"
        android:paddingStart="@dimen/alert_dialog_padding_material"
        android:paddingEnd="@dimen/alert_dialog_padding_material"
        android:paddingTop="24dp"
        android:paddingBottom="24dp" />
+1 −1
Original line number Diff line number Diff line
@@ -4545,7 +4545,7 @@
    <!-- Text spoken when the current user is switched if accessibility is enabled. [CHAR LIMIT=none] -->
    <string name="user_switched">Current user <xliff:g id="name" example="Bob">%1$s</xliff:g>.</string>
    <!-- Message shown when switching to a user [CHAR LIMIT=none] -->
    <string name="user_switching_message">Switching to user <xliff:g id="name" example="Bob">%1$s</xliff:g></string>
    <string name="user_switching_message">Switching to <xliff:g id="name" example="Bob">%1$s</xliff:g>\u2026</string>
    <!-- Default name of the owner user [CHAR LIMIT=20] -->
    <string name="owner_name" msgid="3879126011135546571">Owner</string>
    <!-- Error message title [CHAR LIMIT=35] -->
+1 −0
Original line number Diff line number Diff line
@@ -1253,6 +1253,7 @@
  <java-symbol type="layout" name="restrictions_pin_challenge" />
  <java-symbol type="layout" name="restrictions_pin_setup" />
  <java-symbol type="layout" name="immersive_mode_cling" />
  <java-symbol type="layout" name="user_switching_dialog" />

  <java-symbol type="anim" name="slide_in_child_bottom" />
  <java-symbol type="anim" name="slide_in_right" />
+16 −3
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package com.android.server.am;

import android.app.AlertDialog;
import android.app.Service;
import android.content.ActivityNotFoundException;
import android.content.Context;
@@ -25,7 +26,12 @@ import android.content.res.Resources;
import android.os.Handler;
import android.os.Message;
import android.util.Slog;
import android.view.LayoutInflater;
import android.view.View;
import android.view.WindowManager;
import android.widget.TextView;

import com.android.internal.R;

/**
 * Dialog to show when a user switch it about to happen. The intent is to snapshot the screen
@@ -33,7 +39,7 @@ import android.view.WindowManager;
 * in the background rather than just freeze the screen and not know if the user-switch affordance
 * was being handled.
 */
final class UserSwitchingDialog extends BaseErrorDialog {
final class UserSwitchingDialog extends AlertDialog {
    private static final String TAG = "ActivityManagerUserSwitchingDialog";

    private static final int MSG_START_USER = 1;
@@ -47,9 +53,16 @@ final class UserSwitchingDialog extends BaseErrorDialog {

        mService = service;
        mUserId = userId;
        Resources res = context.getResources();

        // Set up the dialog contents
        setCancelable(false);
        setMessage(res.getString(com.android.internal.R.string.user_switching_message, userName));
        Resources res = getContext().getResources();
        // Custom view due to alignment and font size requirements
        View view = LayoutInflater.from(getContext()).inflate(R.layout.user_switching_dialog, null);
        ((TextView) view.findViewById(R.id.message)).setText(
                res.getString(com.android.internal.R.string.user_switching_message, userName));
        setView(view);

        if (aboveSystem) {
            getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ERROR);
        }