Disable FallbackHome on User 0 in split user system.

Bug: 28870689
Change-Id: Ib0707cc31b1dd0851c918e4effe6d7a3798c801a
(cherry picked from commit 40066f7bfb4feb871d3db88e7575d67971257bea)
This commit is contained in:
Muyuan Li
2016-05-20 14:27:14 -07:00
parent 33658f63af
commit 4811ab4b6d

View File

@@ -21,10 +21,12 @@ import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.os.UserHandle;
import android.os.UserManager;
import android.provider.Settings;
import android.util.Log;
@@ -68,6 +70,12 @@ public class FallbackHome extends Activity {
.addCategory(Intent.CATEGORY_HOME);
final ResolveInfo homeInfo = getPackageManager().resolveActivity(homeIntent, 0);
if (Objects.equals(getPackageName(), homeInfo.activityInfo.packageName)) {
if (UserManager.isSplitSystemUser()
&& UserHandle.myUserId() == UserHandle.USER_SYSTEM) {
// This avoids the situation where the system user has no home activity after
// SUW and this activity continues to throw out warnings. See b/28870689.
return;
}
Log.d(TAG, "User unlocked but no home; let's hope someone enables one soon?");
mHandler.sendEmptyMessageDelayed(0, 500);
} else {