Add fallback encryption-aware home screen.

When the home screen selected by the user isn't encryption aware, we
still need to put something on the ActivityStack.  For now, let's use
an empty activity that knows how to dismiss itself when the
credential-encrypted storage is unlocked; that's enough for the
system to re-resolve the home intent and find the real home screen.

Also follow method refactoring.

Bug: 22358539
Change-Id: Iebc4ad8d2dd62ada079cab03d5765f7631fd4beb
This commit is contained in:
Jeff Sharkey
2015-11-30 13:28:19 -07:00
parent aace27d3db
commit 9e9f7d1116
3 changed files with 61 additions and 3 deletions

View File

@@ -2148,6 +2148,17 @@
</intent-filter>
</activity>
<!-- Triggered when user-selected home app isn't encryption aware -->
<activity android:name=".FallbackHome"
android:excludeFromRecents="true"
android:theme="@android:style/Theme.Translucent.NoTitleBar">
<intent-filter android:priority="-10">
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.HOME" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity android:name=".CryptKeeper$FadeToBlack"
android:immersive="true"
android:launchMode="singleTop"

View File

@@ -0,0 +1,45 @@
/*
* Copyright (C) 2015 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.
*/
package com.android.settings;
import android.app.Activity;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Bundle;
import android.util.Log;
public class FallbackHome extends Activity {
private static final String TAG = "FallbackHome";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
registerReceiver(mReceiver, new IntentFilter(Intent.ACTION_USER_UNLOCKED));
}
private BroadcastReceiver mReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
Log.d(TAG, "User unlocked; leaving to find real home");
unregisterReceiver(this);
finish();
}
};
}

View File

@@ -30,6 +30,7 @@ import android.os.Environment;
import android.os.Handler;
import android.os.Message;
import android.os.RemoteException;
import android.os.UserHandle;
import android.os.storage.StorageManager;
import android.os.storage.VolumeInfo;
import android.support.v7.preference.Preference;
@@ -192,12 +193,13 @@ public class AppStorageSettings extends AppInfoWithHeader
}
private boolean isMoveInProgress() {
final IPackageManager pm = AppGlobals.getPackageManager();
try {
// TODO: define a cleaner API for this
return pm.isPackageFrozen(mPackageName);
} catch (RemoteException e) {
AppGlobals.getPackageManager().checkPackageStartable(mPackageName,
UserHandle.myUserId());
return false;
} catch (RemoteException | SecurityException e) {
return true;
}
}