import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
-import android.content.IntentFilter;
-import android.content.RestrictionEntry;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.os.IUserManager;
import android.os.Process;
import android.os.RemoteException;
-import android.os.SystemClock;
import android.os.UserHandle;
import android.os.UserManager;
import android.util.AtomicFile;
import android.util.Slog;
import android.util.SparseArray;
import android.util.SparseBooleanArray;
-import android.util.SparseLongArray;
import android.util.TimeUtils;
import android.util.Xml;
private boolean mGuestEnabled;
private int mNextSerialNumber;
private int mUserVersion = 0;
- // Temporary cleanup variable, this and associated code should be removed later.
- private boolean mUnblockAppsTemp;
private static UserManagerService sInstance;
final Context context = ActivityThread.systemMain().getSystemContext();
mUserPackageMonitor.register(context,
null, UserHandle.ALL, false);
- context.registerReceiver(mBootCompletedReceiver,
- new IntentFilter(Intent.ACTION_BOOT_COMPLETED));
userForeground(UserHandle.USER_OWNER);
}
return mUserIds;
}
- private void readUserList() {
- synchronized (mPackagesLock) {
- readUserListLocked();
- }
- }
-
private void readUserListLocked() {
mGuestEnabled = false;
if (!mUserListFile.exists()) {
userVersion = 2;
}
- if (userVersion < 3) {
- // Remove restrictions PIN for all users
- for (int i = 0; i < mRestrictionsPinStates.size(); i++) {
- int userId = mRestrictionsPinStates.keyAt(i);
- RestrictionsPinState state = mRestrictionsPinStates.valueAt(i);
- if (state.salt != 0 && state.pinHash != null) {
- removeRestrictionsForUser(userId, false);
- }
- }
- userVersion = 3;
- }
if (userVersion < 4) {
- mUnblockAppsTemp = true;
userVersion = 4;
}
UserInfo.FLAG_ADMIN | UserInfo.FLAG_PRIMARY | UserInfo.FLAG_INITIALIZED);
mUsers.put(0, primary);
mNextSerialNumber = MIN_USER_ID;
+ mUserVersion = USER_VERSION;
Bundle restrictions = new Bundle();
mUserRestrictions.append(UserHandle.USER_OWNER, restrictions);
}
}
};
-
- private BroadcastReceiver mBootCompletedReceiver = new BroadcastReceiver() {
- @Override public void onReceive(Context context, Intent intent) {
- // This code block can be removed after cleanup
- if (mUnblockAppsTemp) {
- synchronized (mPackagesLock) {
- // Unblock apps due to removal of restrictions feature
- for (int i = 0; i < mUsers.size(); i++) {
- int userId = mUsers.keyAt(i);
- unblockAllAppsForUser(userId);
- }
- }
- }
- }
- };
}