Revert^3 "Show 'Loading' message when user0."

This reverts commit 499f93f0fdc21c380139098067e071cf017003f7.

Reason for revert: Roll forward the orginial CL with the fix of the package name change.

=== Original CL ===
Revert "Show 'Loading' message when user0."

Reason for revert: reapporoach the bug with ag/12692792

Reverted Changes:
I1e111b8b9: Show 'Loading' message when user0.
I8da0b4136: Enter user 0 loading screen only if headless mode.
Bug: 166670668
Test: it builds

Change-Id: Ia868bdd4ce0a974c403f2aa53bf982effd7f0a32
Merged-In: Ia868bdd4ce0a974c403f2aa53bf982effd7f0a32
(cherry-picked from commit 55b035a710f6e4303df2b006e1260a50d4e3a023)
diff --git a/res/layout/car_launcher_user0.xml b/res/layout/car_launcher_user0.xml
deleted file mode 100644
index d478fae..0000000
--- a/res/layout/car_launcher_user0.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-  ~ Copyright (C) 2020 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:layout_width="match_parent"
-          android:layout_height="match_parent"
-          android:gravity="center_vertical|center_horizontal"
-          android:textAppearance="?android:attr/textAppearanceLarge"
-          android:text="@string/loading" />
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 1ab39f2..9bb7207 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -76,8 +76,4 @@
         <item>org.chromium.webview_shell</item>
     </string-array>
 
-    <!-- The message will be shown when CarLauncher is invoked for user0, because it's a transient
-         state for waiting for the actual user, we just say "Loading". Appended 3 dots
-         to differentiate with the framework message 'car_loading_profile' -->
-    <string name="loading">Loading...</string>
 </resources>
diff --git a/src/com/android/car/carlauncher/CarLauncher.java b/src/com/android/car/carlauncher/CarLauncher.java
index 240585e..d049239 100644
--- a/src/com/android/car/carlauncher/CarLauncher.java
+++ b/src/com/android/car/carlauncher/CarLauncher.java
@@ -27,8 +27,6 @@
 import android.os.Bundle;
 import android.os.Handler;
 import android.os.Looper;
-import android.os.UserHandle;
-import android.os.UserManager;
 import android.util.Log;
 import android.view.Display;
 import android.view.WindowInsets;
@@ -66,7 +64,6 @@
     private boolean mIsStarted;
     private DisplayManager mDisplayManager;
     private final Handler mMainHandler = new Handler(Looper.getMainLooper());
-    private boolean mIsUser0;
 
     /** Set to {@code true} once we've logged that the Activity is fully drawn. */
     private boolean mIsReadyLogged;
@@ -124,15 +121,6 @@
     @Override
     protected void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
-        // TODO (b/167412330): The following is the workaround for two 'Loading' screen: b/166670668
-        // Investigate if it is caused by the early end of boot-animation, if so, remove the
-        // following code after fixing it.
-        if (getUserId() == UserHandle.USER_SYSTEM && UserManager.isHeadlessSystemUserMode()) {
-            mIsUser0 = true;
-            setContentView(R.layout.car_launcher_user0);
-            getWindow().getInsetsController().hide(WindowInsets.Type.systemBars());
-            return;
-        }
         // Don't show the maps panel in multi window mode.
         // NOTE: CTS tests for split screen are not compatible with activity views on the default
         // activity of the launcher
@@ -167,17 +155,12 @@
     protected void onStop() {
         super.onStop();
         mIsStarted = false;
-        if (mIsUser0) {
-            finish();
-        }
     }
 
     @Override
     protected void onDestroy() {
         super.onDestroy();
-        if (mDisplayManager != null) {
-            mDisplayManager.unregisterDisplayListener(mDisplayListener);
-        }
+        mDisplayManager.unregisterDisplayListener(mDisplayListener);
         if (mActivityView != null && mActivityViewReady) {
             mActivityView.release();
         }