summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
Diffstat (limited to 'services')
-rw-r--r--services/core/java/com/android/server/AssetAtlasService.java2
-rw-r--r--services/core/java/com/android/server/DeviceIdleController.java22
-rw-r--r--services/core/java/com/android/server/am/ActivityStack.java5
-rw-r--r--services/core/java/com/android/server/audio/AudioService.java5
-rw-r--r--services/core/java/com/android/server/fingerprint/FingerprintService.java39
-rw-r--r--services/core/java/com/android/server/pm/PackageInstallerService.java15
-rw-r--r--services/core/java/com/android/server/pm/PackageManagerService.java34
-rw-r--r--services/core/java/com/android/server/pm/Settings.java63
-rw-r--r--services/core/java/com/android/server/policy/PhoneWindowManager.java33
-rw-r--r--services/core/java/com/android/server/policy/keyguard/KeyguardServiceDelegate.java46
-rw-r--r--services/core/java/com/android/server/policy/keyguard/KeyguardServiceWrapper.java15
-rw-r--r--services/core/java/com/android/server/wm/WindowManagerService.java90
-rw-r--r--services/usb/java/com/android/server/usb/UsbDeviceManager.java5
-rw-r--r--services/usb/java/com/android/server/usb/UsbHostManager.java2
-rw-r--r--services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerService.java22
15 files changed, 249 insertions, 149 deletions
diff --git a/services/core/java/com/android/server/AssetAtlasService.java b/services/core/java/com/android/server/AssetAtlasService.java
index ebc810f..4569dae 100644
--- a/services/core/java/com/android/server/AssetAtlasService.java
+++ b/services/core/java/com/android/server/AssetAtlasService.java
@@ -93,7 +93,7 @@ public class AssetAtlasService extends IAssetAtlas.Stub {
// Defines the number of int fields used to represent a single entry
// in the atlas map. This number defines the size of the array returned
// by the getMap(). See the mAtlasMap field for more information
- private static final int ATLAS_MAP_ENTRY_FIELD_COUNT = 4;
+ private static final int ATLAS_MAP_ENTRY_FIELD_COUNT = 3;
// Specifies how our GraphicBuffer will be used. To get proper swizzling
// the buffer will be written to using OpenGL (from JNI) so we can leave
diff --git a/services/core/java/com/android/server/DeviceIdleController.java b/services/core/java/com/android/server/DeviceIdleController.java
index c7c9d29..7561c7d 100644
--- a/services/core/java/com/android/server/DeviceIdleController.java
+++ b/services/core/java/com/android/server/DeviceIdleController.java
@@ -253,6 +253,8 @@ public class DeviceIdleController extends SystemService
"max_temp_app_whitelist_duration";
private static final String KEY_MMS_TEMP_APP_WHITELIST_DURATION =
"mms_temp_app_whitelist_duration";
+ private static final String KEY_SMS_TEMP_APP_WHITELIST_DURATION =
+ "sms_temp_app_whitelist_duration";
/**
* This is the time, after becoming inactive, at which we start looking at the
@@ -357,6 +359,13 @@ public class DeviceIdleController extends SystemService
*/
public long MMS_TEMP_APP_WHITELIST_DURATION;
+ /**
+ * Amount of time we would like to whitelist an app that is receiving an SMS.
+ * @see Settings.Global#DEVICE_IDLE_CONSTANTS
+ * @see #KEY_SMS_TEMP_APP_WHITELIST_DURATION
+ */
+ public long SMS_TEMP_APP_WHITELIST_DURATION;
+
private final ContentResolver mResolver;
private final KeyValueListParser mParser = new KeyValueListParser(',');
@@ -410,6 +419,8 @@ public class DeviceIdleController extends SystemService
KEY_MAX_TEMP_APP_WHITELIST_DURATION, 5 * 60 * 1000L);
MMS_TEMP_APP_WHITELIST_DURATION = mParser.getLong(
KEY_MMS_TEMP_APP_WHITELIST_DURATION, 60 * 1000L);
+ SMS_TEMP_APP_WHITELIST_DURATION = mParser.getLong(
+ KEY_SMS_TEMP_APP_WHITELIST_DURATION, 20 * 1000L);
}
}
@@ -465,6 +476,10 @@ public class DeviceIdleController extends SystemService
pw.print(" "); pw.print(KEY_MMS_TEMP_APP_WHITELIST_DURATION); pw.print("=");
TimeUtils.formatDuration(MMS_TEMP_APP_WHITELIST_DURATION, pw);
pw.println();
+
+ pw.print(" "); pw.print(KEY_SMS_TEMP_APP_WHITELIST_DURATION); pw.print("=");
+ TimeUtils.formatDuration(SMS_TEMP_APP_WHITELIST_DURATION, pw);
+ pw.println();
}
}
@@ -617,6 +632,13 @@ public class DeviceIdleController extends SystemService
return duration;
}
+ @Override public long addPowerSaveTempWhitelistAppForSms(String packageName,
+ int userId, String reason) throws RemoteException {
+ long duration = mConstants.SMS_TEMP_APP_WHITELIST_DURATION;
+ addPowerSaveTempWhitelistApp(packageName, duration, userId, reason);
+ return duration;
+ }
+
@Override public void exitIdle(String reason) {
getContext().enforceCallingOrSelfPermission(android.Manifest.permission.DEVICE_POWER,
null);
diff --git a/services/core/java/com/android/server/am/ActivityStack.java b/services/core/java/com/android/server/am/ActivityStack.java
index e57e3ff..a75cc48 100644
--- a/services/core/java/com/android/server/am/ActivityStack.java
+++ b/services/core/java/com/android/server/am/ActivityStack.java
@@ -617,12 +617,9 @@ final class ActivityStack {
for (int activityNdx = activities.size() - 1; activityNdx >= 0; --activityNdx) {
ActivityRecord r = activities.get(activityNdx);
if (notCurrentUserTask && (r.info.flags & FLAG_SHOW_FOR_ALL_USERS) == 0) {
- return null;
+ continue;
}
if (!r.finishing && r.intent.getComponent().equals(cls) && r.userId == userId) {
- //Slog.i(TAG, "Found matching class!");
- //dump();
- //Slog.i(TAG, "For Intent " + intent + " bringing to top: " + r.intent);
return r;
}
}
diff --git a/services/core/java/com/android/server/audio/AudioService.java b/services/core/java/com/android/server/audio/AudioService.java
index eef3d63..1223a00 100644
--- a/services/core/java/com/android/server/audio/AudioService.java
+++ b/services/core/java/com/android/server/audio/AudioService.java
@@ -5126,6 +5126,11 @@ public class AudioService extends IAudioService.Stub {
if (UserHandle.getAppId(pkg.applicationInfo.uid) < FIRST_APPLICATION_UID) {
continue;
}
+ // Skip packages that have permission to interact across users
+ if (pm.checkPermission(Manifest.permission.INTERACT_ACROSS_USERS, pkg.packageName)
+ == PackageManager.PERMISSION_GRANTED) {
+ continue;
+ }
if (homeActivityName != null
&& pkg.packageName.equals(homeActivityName.getPackageName())
&& pkg.applicationInfo.isSystemApp()) {
diff --git a/services/core/java/com/android/server/fingerprint/FingerprintService.java b/services/core/java/com/android/server/fingerprint/FingerprintService.java
index 8871e64..c705fbf 100644
--- a/services/core/java/com/android/server/fingerprint/FingerprintService.java
+++ b/services/core/java/com/android/server/fingerprint/FingerprintService.java
@@ -74,7 +74,6 @@ public class FingerprintService extends SystemService implements IBinder.DeathRe
private static final int MSG_USER_SWITCHING = 10;
private static final int ENROLLMENT_TIMEOUT_MS = 60 * 1000; // 1 minute
- private boolean mIsKeyguard; // true if the authentication client is keyguard
private ClientMonitor mAuthClient = null;
private ClientMonitor mEnrollClient = null;
private ClientMonitor mRemoveClient = null;
@@ -124,20 +123,29 @@ public class FingerprintService extends SystemService implements IBinder.DeathRe
public void binderDied() {
Slog.v(TAG, "fingerprintd died");
mDaemon = null;
+ dispatchError(mHalDeviceId, FingerprintManager.FINGERPRINT_ERROR_HW_UNAVAILABLE);
}
public IFingerprintDaemon getFingerprintDaemon() {
if (mDaemon == null) {
mDaemon = IFingerprintDaemon.Stub.asInterface(ServiceManager.getService(FINGERPRINTD));
- if (mDaemon == null) {
- Slog.w(TAG, "fingerprind service not available");
- } else {
+ if (mDaemon != null) {
try {
mDaemon.asBinder().linkToDeath(this, 0);
- } catch (RemoteException e) {
- Slog.w(TAG, "caught remote exception in linkToDeath: ", e);
- mDaemon = null; // try again!
+ mDaemon.init(mDaemonCallback);
+ mHalDeviceId = mDaemon.openHal();
+ if (mHalDeviceId != 0) {
+ updateActiveGroup(ActivityManager.getCurrentUser());
+ } else {
+ Slog.w(TAG, "Failed to open Fingerprint HAL!");
+ mDaemon = null;
+ }
+ } catch (RemoteException e) {
+ Slog.e(TAG, "Failed to open fingeprintd HAL", e);
+ mDaemon = null; // try again later!
}
+ } else {
+ Slog.w(TAG, "fingerprint service not available");
}
}
return mDaemon;
@@ -156,7 +164,6 @@ public class FingerprintService extends SystemService implements IBinder.DeathRe
protected void dispatchRemoved(long deviceId, int fingerId, int groupId) {
final ClientMonitor client = mRemoveClient;
if (fingerId != 0) {
- ContentResolver res = mContext.getContentResolver();
removeTemplateForUser(mRemoveClient, fingerId);
}
if (client != null && client.sendRemoved(fingerId, groupId)) {
@@ -577,12 +584,6 @@ public class FingerprintService extends SystemService implements IBinder.DeathRe
result |= true; // we have a valid fingerprint
mLockoutReset.run();
}
- // For fingerprint devices that support touch-to-wake, this will ensure the device
- // wakes up and turns the screen on when fingerprint is authenticated.
- if (mIsKeyguard && authenticated) {
- mPowerManager.wakeUp(SystemClock.uptimeMillis(),
- "android.server.fingerprint:AUTH");
- }
return result;
}
@@ -727,7 +728,6 @@ public class FingerprintService extends SystemService implements IBinder.DeathRe
mHandler.post(new Runnable() {
@Override
public void run() {
- mIsKeyguard = KEYGUARD_PACKAGE.equals(opPackageName);
startAuthentication(token, opId, groupId, receiver, flags, restricted);
}
});
@@ -821,15 +821,6 @@ public class FingerprintService extends SystemService implements IBinder.DeathRe
public void onStart() {
publishBinderService(Context.FINGERPRINT_SERVICE, new FingerprintServiceWrapper());
IFingerprintDaemon daemon = getFingerprintDaemon();
- if (daemon != null) {
- try {
- daemon.init(mDaemonCallback);
- mHalDeviceId = daemon.openHal();
- updateActiveGroup(ActivityManager.getCurrentUser());
- } catch (RemoteException e) {
- Slog.e(TAG, "Failed to open fingeprintd HAL", e);
- }
- }
if (DEBUG) Slog.v(TAG, "Fingerprint HAL id: " + mHalDeviceId);
listenForUserSwitches();
}
diff --git a/services/core/java/com/android/server/pm/PackageInstallerService.java b/services/core/java/com/android/server/pm/PackageInstallerService.java
index 07de6f5..0366fff 100644
--- a/services/core/java/com/android/server/pm/PackageInstallerService.java
+++ b/services/core/java/com/android/server/pm/PackageInstallerService.java
@@ -91,7 +91,6 @@ import com.android.internal.util.FastXmlSerializer;
import com.android.internal.util.ImageUtils;
import com.android.internal.util.IndentingPrintWriter;
import com.android.server.IoThread;
-import com.google.android.collect.Sets;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
@@ -106,6 +105,7 @@ import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.security.SecureRandom;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.Random;
@@ -221,7 +221,7 @@ public class PackageInstallerService extends IPackageInstaller.Stub {
reconcileStagesLocked(StorageManager.UUID_PRIVATE_INTERNAL);
- final ArraySet<File> unclaimedIcons = Sets.newArraySet(
+ final ArraySet<File> unclaimedIcons = newArraySet(
mSessionsDir.listFiles());
// Ignore stages and icons claimed by active sessions
@@ -245,7 +245,7 @@ public class PackageInstallerService extends IPackageInstaller.Stub {
private void reconcileStagesLocked(String volumeUuid) {
final File stagingDir = buildStagingDir(volumeUuid);
- final ArraySet<File> unclaimedStages = Sets.newArraySet(
+ final ArraySet<File> unclaimedStages = newArraySet(
stagingDir.listFiles(sStageFilter));
// Ignore stages claimed by active sessions
@@ -1091,6 +1091,15 @@ public class PackageInstallerService extends IPackageInstaller.Stub {
.build();
}
+ public static <E> ArraySet<E> newArraySet(E... elements) {
+ final ArraySet<E> set = new ArraySet<E>();
+ if (elements != null) {
+ set.ensureCapacity(elements.length);
+ Collections.addAll(set, elements);
+ }
+ return set;
+ }
+
private static class Callbacks extends Handler {
private static final int MSG_SESSION_CREATED = 1;
private static final int MSG_SESSION_BADGING_CHANGED = 2;
diff --git a/services/core/java/com/android/server/pm/PackageManagerService.java b/services/core/java/com/android/server/pm/PackageManagerService.java
index c139389..0b74996 100644
--- a/services/core/java/com/android/server/pm/PackageManagerService.java
+++ b/services/core/java/com/android/server/pm/PackageManagerService.java
@@ -7321,6 +7321,9 @@ public class PackageManagerService extends IPackageManager.Stub {
for (i=0; i<N; i++) {
PackageParser.Permission p = pkg.permissions.get(i);
+ // Assume by default that we did not install this permission into the system.
+ p.info.flags &= ~PermissionInfo.FLAG_INSTALLED;
+
// Now that permission groups have a special meaning, we ignore permission
// groups for legacy apps to prevent unexpected behavior. In particular,
// permissions for one app being granted to someone just becuase they happen
@@ -7350,6 +7353,7 @@ public class PackageManagerService extends IPackageManager.Stub {
bp.perm = p;
bp.uid = pkg.applicationInfo.uid;
bp.sourcePackage = p.info.packageName;
+ p.info.flags |= PermissionInfo.FLAG_INSTALLED;
} else if (!currentOwnerIsSystem) {
String msg = "New decl " + p.owner + " of permission "
+ p.info.name + " is system; overriding " + bp.sourcePackage;
@@ -7375,6 +7379,7 @@ public class PackageManagerService extends IPackageManager.Stub {
bp.perm = p;
bp.uid = pkg.applicationInfo.uid;
bp.sourcePackage = p.info.packageName;
+ p.info.flags |= PermissionInfo.FLAG_INSTALLED;
if ((parseFlags&PackageParser.PARSE_CHATTY) != 0) {
if (r == null) {
r = new StringBuilder(256);
@@ -14688,12 +14693,12 @@ public class PackageManagerService extends IPackageManager.Stub {
pw.println(" s[hared-users]: dump shared user IDs");
pw.println(" m[essages]: print collected runtime messages");
pw.println(" v[erifiers]: print package verifier info");
+ pw.println(" d[omain-preferred-apps]: print domains preferred apps");
+ pw.println(" i[ntent-filter-verifiers]|ifv: print intent filter verifier info");
pw.println(" version: print database version info");
pw.println(" write: write current settings now");
- pw.println(" <package.name>: info about given package");
pw.println(" installs: details about install sessions");
- pw.println(" d[omain-preferred-apps]: print domains preferred apps");
- pw.println(" i[ntent-filter-verifiers]|ifv: print intent filter verifier info");
+ pw.println(" <package.name>: info about given package");
return;
} else if ("--checkin".equals(opt)) {
checkin = true;
@@ -15600,12 +15605,8 @@ public class PackageManagerService extends IPackageManager.Stub {
* recycled.
*/
private void reconcileUsers(String volumeUuid) {
- final File[] files = Environment.getDataUserDirectory(volumeUuid).listFiles();
- if (ArrayUtils.isEmpty(files)) {
- Slog.d(TAG, "No users found on " + volumeUuid);
- return;
- }
-
+ final File[] files = FileUtils
+ .listFilesOrEmpty(Environment.getDataUserDirectory(volumeUuid));
for (File file : files) {
if (!file.isDirectory()) continue;
@@ -15661,12 +15662,8 @@ public class PackageManagerService extends IPackageManager.Stub {
* another volume.
*/
private void reconcileApps(String volumeUuid) {
- final File[] files = Environment.getDataAppDirectory(volumeUuid).listFiles();
- if (ArrayUtils.isEmpty(files)) {
- Slog.d(TAG, "No apps found on " + volumeUuid);
- return;
- }
-
+ final File[] files = FileUtils
+ .listFilesOrEmpty(Environment.getDataAppDirectory(volumeUuid));
for (File file : files) {
final boolean isPackage = (isApkFile(file) || file.isDirectory())
&& !PackageInstallerService.isStageName(file.getName());
@@ -15797,7 +15794,12 @@ public class PackageManagerService extends IPackageManager.Stub {
}
// Now that we're guarded by frozen state, kill app during move
- killApplication(packageName, appId, "move pkg");
+ final long token = Binder.clearCallingIdentity();
+ try {
+ killApplication(packageName, appId, "move pkg");
+ } finally {
+ Binder.restoreCallingIdentity(token);
+ }
final Bundle extras = new Bundle();
extras.putString(Intent.EXTRA_PACKAGE_NAME, packageName);
diff --git a/services/core/java/com/android/server/pm/Settings.java b/services/core/java/com/android/server/pm/Settings.java
index 92b9da6..736b153 100644
--- a/services/core/java/com/android/server/pm/Settings.java
+++ b/services/core/java/com/android/server/pm/Settings.java
@@ -4120,6 +4120,28 @@ final class Settings {
pw.print(prefix); pw.print(" pkgFlags="); printFlags(pw, ps.pkgFlags, FLAG_DUMP_SPEC);
pw.println();
+ if (ps.pkg != null && ps.pkg.permissions != null && ps.pkg.permissions.size() > 0) {
+ final ArrayList<PackageParser.Permission> perms = ps.pkg.permissions;
+ pw.print(prefix); pw.println(" declared permissions:");
+ for (int i=0; i<perms.size(); i++) {
+ PackageParser.Permission perm = perms.get(i);
+ if (permissionNames != null
+ && !permissionNames.contains(perm.info.name)) {
+ continue;
+ }
+ pw.print(prefix); pw.print(" "); pw.print(perm.info.name);
+ pw.print(": prot=");
+ pw.print(PermissionInfo.protectionToString(perm.info.protectionLevel));
+ if ((perm.info.flags&PermissionInfo.FLAG_COSTS_MONEY) != 0) {
+ pw.print(", COSTS_MONEY");
+ }
+ if ((perm.info.flags&PermissionInfo.FLAG_INSTALLED) != 0) {
+ pw.print(", INSTALLED");
+ }
+ pw.println();
+ }
+ }
+
if (ps.sharedUser == null || permissionNames != null) {
PermissionsState permissionsState = ps.getPermissionsState();
dumpInstallPermissionsLPr(pw, prefix + " ", permissionNames, permissionsState);
@@ -4155,14 +4177,14 @@ final class Settings {
if (cmp != null && cmp.size() > 0) {
pw.print(prefix); pw.println(" disabledComponents:");
for (String s : cmp) {
- pw.print(prefix); pw.print(" "); pw.println(s);
+ pw.print(prefix); pw.print(" "); pw.println(s);
}
}
cmp = ps.getEnabledComponents(user.id);
if (cmp != null && cmp.size() > 0) {
pw.print(prefix); pw.println(" enabledComponents:");
for (String s : cmp) {
- pw.print(prefix); pw.print(" "); pw.println(s);
+ pw.print(prefix); pw.print(" "); pw.println(s);
}
}
}
@@ -4267,11 +4289,14 @@ final class Settings {
pw.print(" type="); pw.print(p.type);
pw.print(" prot=");
pw.println(PermissionInfo.protectionToString(p.protectionLevel));
- if (p.packageSetting != null) {
- pw.print(" packageSetting="); pw.println(p.packageSetting);
- }
if (p.perm != null) {
pw.print(" perm="); pw.println(p.perm);
+ if (p.perm.info.flags != PermissionInfo.FLAG_INSTALLED) {
+ pw.print(" flags=0x"); pw.println(Integer.toHexString(p.perm.info.flags));
+ }
+ }
+ if (p.packageSetting != null) {
+ pw.print(" packageSetting="); pw.println(p.packageSetting);
}
if (READ_EXTERNAL_STORAGE.equals(p.name)) {
pw.print(" enforced=");
@@ -4372,24 +4397,32 @@ final class Settings {
continue;
}
pw.print(prefix); pw.print(" "); pw.print(permissionState.getName());
- pw.print(", granted="); pw.print(permissionState.isGranted());
- pw.print(", flags="); pw.println(permissionFlagsToString(
- permissionState.getFlags()));
+ pw.print(": granted="); pw.print(permissionState.isGranted());
+ pw.println(permissionFlagsToString(", flags=",
+ permissionState.getFlags()));
}
}
}
- private static String permissionFlagsToString(int flags) {
- StringBuilder flagsString = new StringBuilder();
- flagsString.append("[ ");
+ private static String permissionFlagsToString(String prefix, int flags) {
+ StringBuilder flagsString = null;
while (flags != 0) {
+ if (flagsString == null) {
+ flagsString = new StringBuilder();
+ flagsString.append(prefix);
+ flagsString.append("[ ");
+ }
final int flag = 1 << Integer.numberOfTrailingZeros(flags);
flags &= ~flag;
flagsString.append(PackageManager.permissionFlagToString(flag));
flagsString.append(' ');
}
- flagsString.append(']');
- return flagsString.toString();
+ if (flagsString != null) {
+ flagsString.append(']');
+ return flagsString.toString();
+ } else {
+ return "";
+ }
}
void dumpInstallPermissionsLPr(PrintWriter pw, String prefix, ArraySet<String> permissionNames,
@@ -4403,8 +4436,8 @@ final class Settings {
continue;
}
pw.print(prefix); pw.print(" "); pw.print(permissionState.getName());
- pw.print(", granted="); pw.print(permissionState.isGranted());
- pw.print(", flags="); pw.println(permissionFlagsToString(
+ pw.print(": granted="); pw.print(permissionState.isGranted());
+ pw.println(permissionFlagsToString(", flags=",
permissionState.getFlags()));
}
}
diff --git a/services/core/java/com/android/server/policy/PhoneWindowManager.java b/services/core/java/com/android/server/policy/PhoneWindowManager.java
index 28cbaab..dc3e2d6 100644
--- a/services/core/java/com/android/server/policy/PhoneWindowManager.java
+++ b/services/core/java/com/android/server/policy/PhoneWindowManager.java
@@ -119,7 +119,7 @@ import com.android.internal.util.ScreenShapeHelper;
import com.android.internal.widget.PointerLocationView;
import com.android.server.LocalServices;
import com.android.server.policy.keyguard.KeyguardServiceDelegate;
-import com.android.server.policy.keyguard.KeyguardServiceDelegate.ShowListener;
+import com.android.server.policy.keyguard.KeyguardServiceDelegate.DrawnListener;
import java.io.File;
import java.io.FileReader;
@@ -323,10 +323,10 @@ public class PhoneWindowManager implements WindowManagerPolicy {
mHandler.sendEmptyMessage(MSG_WINDOW_MANAGER_DRAWN_COMPLETE);
}
};
- final ShowListener mKeyguardDelegateCallback = new ShowListener() {
+ final DrawnListener mKeyguardDrawnCallback = new DrawnListener() {
@Override
- public void onShown(IBinder windowToken) {
- if (DEBUG_WAKEUP) Slog.d(TAG, "mKeyguardDelegate.ShowListener.onShown.");
+ public void onDrawn() {
+ if (DEBUG_WAKEUP) Slog.d(TAG, "mKeyguardDelegate.ShowListener.onDrawn.");
mHandler.sendEmptyMessage(MSG_KEYGUARD_DRAWN_COMPLETE);
}
};
@@ -5496,11 +5496,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
}
if (mKeyguardDelegate != null) {
- mKeyguardDelegate.onStartedWakingUp(mKeyguardDelegateCallback);
- // ... eventually calls finishKeyguardDrawn
- } else {
- if (DEBUG_WAKEUP) Slog.d(TAG, "null mKeyguardDelegate: setting mKeyguardDrawComplete.");
- finishKeyguardDrawn();
+ mKeyguardDelegate.onStartedWakingUp();
}
}
@@ -5539,9 +5535,13 @@ public class PhoneWindowManager implements WindowManagerPolicy {
if (mKeyguardDelegate != null) {
mHandler.removeMessages(MSG_KEYGUARD_DRAWN_TIMEOUT);
}
+ mWindowManagerDrawComplete = false;
}
- finishScreenTurningOn();
+ // ... eventually calls finishWindowsDrawn which will finalize our screen turn on
+ // as well as enabling the orientation change logic/sensor.
+ mWindowManagerInternal.waitForAllWindowsDrawn(mWindowManagerDrawCallback,
+ WAITING_FOR_DRAWN_TIMEOUT);
}
// Called on the DisplayManager's DisplayPowerController thread.
@@ -5570,12 +5570,15 @@ public class PhoneWindowManager implements WindowManagerPolicy {
mScreenOnFully = false;
mWindowManagerDrawComplete = false;
mScreenOnListener = screenOnListener;
- }
- mWindowManagerInternal.waitForAllWindowsDrawn(mWindowManagerDrawCallback,
- WAITING_FOR_DRAWN_TIMEOUT);
- // ... eventually calls finishWindowsDrawn which will finalize our screen turn on
- // as well as enabling the orientation change logic/sensor.
+ if (mKeyguardDelegate != null) {
+ mKeyguardDelegate.onScreenTurningOn(mKeyguardDrawnCallback);
+ } else {
+ if (DEBUG_WAKEUP) Slog.d(TAG,
+ "null mKeyguardDelegate: setting mKeyguardDrawComplete.");
+ finishKeyguardDrawn();
+ }
+ }
}
private void finishWindowsDrawn() {
diff --git a/services/core/java/com/android/server/policy/keyguard/KeyguardServiceDelegate.java b/services/core/java/com/android/server/policy/keyguard/KeyguardServiceDelegate.java
index 1406789..0f3a199 100644
--- a/services/core/java/com/android/server/policy/keyguard/KeyguardServiceDelegate.java
+++ b/services/core/java/com/android/server/policy/keyguard/KeyguardServiceDelegate.java
@@ -18,9 +18,9 @@ import android.view.ViewGroup;
import android.view.WindowManager;
import android.view.WindowManagerPolicy.OnKeyguardExitResult;
+import com.android.internal.policy.IKeyguardDrawnCallback;
import com.android.internal.policy.IKeyguardExitCallback;
import com.android.internal.policy.IKeyguardService;
-import com.android.internal.policy.IKeyguardShowCallback;
/**
* A local class that keeps a cache of keyguard state that can be restored in the event
@@ -35,7 +35,7 @@ public class KeyguardServiceDelegate {
private final Context mContext;
private final View mScrim; // shown if keyguard crashes
private final KeyguardState mKeyguardState = new KeyguardState();
- private ShowListener mShowListenerWhenConnect;
+ private DrawnListener mDrawnListenerWhenConnect;
private static final class KeyguardState {
KeyguardState() {
@@ -61,23 +61,23 @@ public class KeyguardServiceDelegate {
public boolean bootCompleted;
};
- public interface ShowListener {
- public void onShown(IBinder windowToken);
+ public interface DrawnListener {
+ void onDrawn();
}
// A delegate class to map a particular invocation with a ShowListener object.
- private final class KeyguardShowDelegate extends IKeyguardShowCallback.Stub {
- private ShowListener mShowListener;
+ private final class KeyguardShowDelegate extends IKeyguardDrawnCallback.Stub {
+ private DrawnListener mDrawnListener;
- KeyguardShowDelegate(ShowListener showListener) {
- mShowListener = showListener;
+ KeyguardShowDelegate(DrawnListener drawnListener) {
+ mDrawnListener = drawnListener;
}
@Override
- public void onShown(IBinder windowToken) throws RemoteException {
+ public void onDrawn() throws RemoteException {
if (DEBUG) Log.v(TAG, "**** SHOWN CALLED ****");
- if (mShowListener != null) {
- mShowListener.onShown(windowToken);
+ if (mDrawnListener != null) {
+ mDrawnListener.onDrawn();
}
hideScrim();
}
@@ -141,9 +141,10 @@ public class KeyguardServiceDelegate {
// If the system is ready, it means keyguard crashed and restarted.
mKeyguardService.onSystemReady();
// This is used to hide the scrim once keyguard displays.
- mKeyguardService.onStartedWakingUp(new KeyguardShowDelegate(
- mShowListenerWhenConnect));
- mShowListenerWhenConnect = null;
+ mKeyguardService.onStartedWakingUp();
+ mKeyguardService.onScreenTurningOn(
+ new KeyguardShowDelegate(mDrawnListenerWhenConnect));
+ mDrawnListenerWhenConnect = null;
}
if (mKeyguardState.bootCompleted) {
mKeyguardService.onBootCompleted();
@@ -221,16 +222,23 @@ public class KeyguardServiceDelegate {
mKeyguardState.dreaming = false;
}
- public void onStartedWakingUp(final ShowListener showListener) {
+ public void onStartedWakingUp() {
if (mKeyguardService != null) {
- if (DEBUG) Log.v(TAG, "onScreenTurnedOn(showListener = " + showListener + ")");
- mKeyguardService.onStartedWakingUp(new KeyguardShowDelegate(showListener));
+ if (DEBUG) Log.v(TAG, "onStartedWakingUp()");
+ mKeyguardService.onStartedWakingUp();
+ }
+ }
+
+ public void onScreenTurningOn(final DrawnListener drawnListener) {
+ if (mKeyguardService != null) {
+ if (DEBUG) Log.v(TAG, "onScreenTurnedOn(showListener = " + drawnListener + ")");
+ mKeyguardService.onScreenTurningOn(new KeyguardShowDelegate(drawnListener));
} else {
// try again when we establish a connection
- Slog.w(TAG, "onScreenTurnedOn(): no keyguard service!");
+ Slog.w(TAG, "onScreenTurningOn(): no keyguard service!");
// This shouldn't happen, but if it does, show the scrim immediately and
// invoke the listener's callback after the service actually connects.
- mShowListenerWhenConnect = showListener;
+ mDrawnListenerWhenConnect = drawnListener;
showScrim();
}
}
diff --git a/services/core/java/com/android/server/policy/keyguard/KeyguardServiceWrapper.java b/services/core/java/com/android/server/policy/keyguard/KeyguardServiceWrapper.java
index 51d59fa..5810a45 100644
--- a/services/core/java/com/android/server/policy/keyguard/KeyguardServiceWrapper.java
+++ b/services/core/java/com/android/server/policy/keyguard/KeyguardServiceWrapper.java
@@ -22,9 +22,9 @@ import android.os.IBinder;
import android.os.RemoteException;
import android.util.Slog;
+import com.android.internal.policy.IKeyguardDrawnCallback;
import com.android.internal.policy.IKeyguardExitCallback;
import com.android.internal.policy.IKeyguardService;
-import com.android.internal.policy.IKeyguardShowCallback;
import com.android.internal.policy.IKeyguardStateCallback;
/**
@@ -124,9 +124,18 @@ public class KeyguardServiceWrapper implements IKeyguardService {
}
@Override
- public void onStartedWakingUp(IKeyguardShowCallback callback) {
+ public void onStartedWakingUp() {
try {
- mService.onStartedWakingUp(callback);
+ mService.onStartedWakingUp();
+ } catch (RemoteException e) {
+ Slog.w(TAG , "Remote Exception", e);
+ }
+ }
+
+ @Override
+ public void onScreenTurningOn(IKeyguardDrawnCallback callback) {
+ try {
+ mService.onScreenTurningOn(callback);
} catch (RemoteException e) {
Slog.w(TAG , "Remote Exception", e);
}
diff --git a/services/core/java/com/android/server/wm/WindowManagerService.java b/services/core/java/com/android/server/wm/WindowManagerService.java
index 4f2b1f9..d9828cc 100644
--- a/services/core/java/com/android/server/wm/WindowManagerService.java
+++ b/services/core/java/com/android/server/wm/WindowManagerService.java
@@ -10029,70 +10029,70 @@ public class WindowManagerService extends IWindowManager.Stub
WindowManagerPolicy.FINISH_LAYOUT_REDO_LAYOUT;
if (DEBUG_LAYOUT_REPEATS) {
debugLayoutRepeats(
- "dream and commitFinishDrawingLocked true",
- displayContent.pendingLayoutChanges);
+ "dream and commitFinishDrawingLocked true",
+ displayContent.pendingLayoutChanges);
}
}
if ((w.mAttrs.flags & FLAG_SHOW_WALLPAPER) != 0) {
if (DEBUG_WALLPAPER_LIGHT) Slog.v(TAG,
- "First draw done in potential wallpaper target " + w);
+ "First draw done in potential wallpaper target " + w);
mInnerFields.mWallpaperMayChange = true;
displayContent.pendingLayoutChanges |=
WindowManagerPolicy.FINISH_LAYOUT_REDO_WALLPAPER;
if (DEBUG_LAYOUT_REPEATS) {
debugLayoutRepeats(
- "wallpaper and commitFinishDrawingLocked true",
- displayContent.pendingLayoutChanges);
+ "wallpaper and commitFinishDrawingLocked true",
+ displayContent.pendingLayoutChanges);
}
}
}
winAnimator.setSurfaceBoundariesLocked(recoveringMemory);
+ }
- final AppWindowToken atoken = w.mAppToken;
- if (DEBUG_STARTING_WINDOW && atoken != null
- && w == atoken.startingWindow) {
- Slog.d(TAG, "updateWindows: starting " + w + " isOnScreen="
- + w.isOnScreen() + " allDrawn=" + atoken.allDrawn
- + " freezingScreen=" + atoken.mAppAnimator.freezingScreen);
+ final AppWindowToken atoken = w.mAppToken;
+ if (DEBUG_STARTING_WINDOW && atoken != null
+ && w == atoken.startingWindow) {
+ Slog.d(TAG, "updateWindows: starting " + w + " isOnScreen="
+ + w.isOnScreen() + " allDrawn=" + atoken.allDrawn
+ + " freezingScreen=" + atoken.mAppAnimator.freezingScreen);
+ }
+ if (atoken != null
+ && (!atoken.allDrawn || atoken.mAppAnimator.freezingScreen)) {
+ if (atoken.lastTransactionSequence != mTransactionSequence) {
+ atoken.lastTransactionSequence = mTransactionSequence;
+ atoken.numInterestingWindows = atoken.numDrawnWindows = 0;
+ atoken.startingDisplayed = false;
}
- if (atoken != null
- && (!atoken.allDrawn || atoken.mAppAnimator.freezingScreen)) {
- if (atoken.lastTransactionSequence != mTransactionSequence) {
- atoken.lastTransactionSequence = mTransactionSequence;
- atoken.numInterestingWindows = atoken.numDrawnWindows = 0;
- atoken.startingDisplayed = false;
- }
- if ((w.isOnScreenIgnoringKeyguard()
- || winAnimator.mAttrType == TYPE_BASE_APPLICATION)
- && !w.mExiting && !w.mDestroying) {
- if (DEBUG_VISIBILITY || DEBUG_ORIENTATION) {
- Slog.v(TAG, "Eval win " + w + ": isDrawn=" + w.isDrawnLw()
- + ", isAnimating=" + winAnimator.isAnimating());
- if (!w.isDrawnLw()) {
- Slog.v(TAG, "Not displayed: s=" + winAnimator.mSurfaceControl
- + " pv=" + w.mPolicyVisibility
- + " mDrawState=" + winAnimator.drawStateToString()
- + " ah=" + w.mAttachedHidden
- + " th=" + atoken.hiddenRequested
- + " a=" + winAnimator.mAnimating);
- }
+ if ((w.isOnScreenIgnoringKeyguard()
+ || winAnimator.mAttrType == TYPE_BASE_APPLICATION)
+ && !w.mExiting && !w.mDestroying) {
+ if (DEBUG_VISIBILITY || DEBUG_ORIENTATION) {
+ Slog.v(TAG, "Eval win " + w + ": isDrawn=" + w.isDrawnLw()
+ + ", isAnimating=" + winAnimator.isAnimating());
+ if (!w.isDrawnLw()) {
+ Slog.v(TAG, "Not displayed: s=" + winAnimator.mSurfaceControl
+ + " pv=" + w.mPolicyVisibility
+ + " mDrawState=" + winAnimator.drawStateToString()
+ + " ah=" + w.mAttachedHidden
+ + " th=" + atoken.hiddenRequested
+ + " a=" + winAnimator.mAnimating);
}
- if (w != atoken.startingWindow) {
- if (!atoken.mAppAnimator.freezingScreen || !w.mAppFreezing) {
- atoken.numInterestingWindows++;
- if (w.isDrawnLw()) {
- atoken.numDrawnWindows++;
- if (DEBUG_VISIBILITY || DEBUG_ORIENTATION) Slog.v(TAG,
- "tokenMayBeDrawn: " + atoken
- + " freezingScreen=" + atoken.mAppAnimator.freezingScreen
- + " mAppFreezing=" + w.mAppFreezing);
- updateAllDrawn = true;
- }
+ }
+ if (w != atoken.startingWindow) {
+ if (!atoken.mAppAnimator.freezingScreen || !w.mAppFreezing) {
+ atoken.numInterestingWindows++;
+ if (w.isDrawnLw()) {
+ atoken.numDrawnWindows++;
+ if (DEBUG_VISIBILITY || DEBUG_ORIENTATION) Slog.v(TAG,
+ "tokenMayBeDrawn: " + atoken
+ + " freezingScreen=" + atoken.mAppAnimator.freezingScreen
+ + " mAppFreezing=" + w.mAppFreezing);
+ updateAllDrawn = true;
}
- } else if (w.isDrawnLw()) {
- atoken.startingDisplayed = true;
}
+ } else if (w.isDrawnLw()) {
+ atoken.startingDisplayed = true;
}
}
}
diff --git a/services/usb/java/com/android/server/usb/UsbDeviceManager.java b/services/usb/java/com/android/server/usb/UsbDeviceManager.java
index 1787b91..4cfa37a 100644
--- a/services/usb/java/com/android/server/usb/UsbDeviceManager.java
+++ b/services/usb/java/com/android/server/usb/UsbDeviceManager.java
@@ -49,10 +49,8 @@ import com.android.internal.util.IndentingPrintWriter;
import com.android.server.FgThread;
import java.io.File;
-import java.io.FileDescriptor;
import java.io.FileNotFoundException;
import java.io.IOException;
-import java.io.PrintWriter;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
@@ -807,8 +805,7 @@ public class UsbDeviceManager {
}
private String getDefaultFunctions() {
- return SystemProperties.get(USB_PERSISTENT_CONFIG_PROPERTY,
- UsbManager.USB_FUNCTION_ADB);
+ return mAdbEnabled ? UsbManager.USB_FUNCTION_ADB : UsbManager.USB_FUNCTION_MTP;
}
public void dump(IndentingPrintWriter pw) {
diff --git a/services/usb/java/com/android/server/usb/UsbHostManager.java b/services/usb/java/com/android/server/usb/UsbHostManager.java
index 6300a9a..965341e 100644
--- a/services/usb/java/com/android/server/usb/UsbHostManager.java
+++ b/services/usb/java/com/android/server/usb/UsbHostManager.java
@@ -231,6 +231,8 @@ public class UsbHostManager {
mNewConfigurations = null;
mNewInterfaces = null;
mNewEndpoints = null;
+ mNewConfiguration = null;
+ mNewInterface = null;
}
}
diff --git a/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerService.java b/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerService.java
index b57c413..a8874d0 100644
--- a/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerService.java
+++ b/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerService.java
@@ -894,6 +894,28 @@ public class VoiceInteractionManagerService extends SystemService {
}
@Override
+ public void onLockscreenShown() {
+ enforceCallingPermission(Manifest.permission.ACCESS_VOICE_INTERACTION_SERVICE);
+ synchronized (this) {
+ if (mImpl == null) {
+ return;
+ }
+ final long caller = Binder.clearCallingIdentity();
+ try {
+ if (mImpl.mActiveSession != null && mImpl.mActiveSession.mSession != null) {
+ try {
+ mImpl.mActiveSession.mSession.onLockscreenShown();
+ } catch (RemoteException e) {
+ Log.w(TAG, "Failed to call onLockscreenShown", e);
+ }
+ }
+ } finally {
+ Binder.restoreCallingIdentity(caller);
+ }
+ }
+ }
+
+ @Override
public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
if (mContext.checkCallingOrSelfPermission(Manifest.permission.DUMP)
!= PackageManager.PERMISSION_GRANTED) {