summaryrefslogtreecommitdiffstats
path: root/services/java/com/android
diff options
context:
space:
mode:
Diffstat (limited to 'services/java/com/android')
-rw-r--r--services/java/com/android/server/IntentResolver.java35
-rw-r--r--services/java/com/android/server/PreferredComponent.java9
-rw-r--r--services/java/com/android/server/am/ActivityManagerService.java3
-rwxr-xr-xservices/java/com/android/server/pm/PackageManagerService.java8
-rw-r--r--services/java/com/android/server/print/RemotePrintService.java17
-rw-r--r--services/java/com/android/server/print/UserState.java17
-rw-r--r--services/java/com/android/server/wm/WindowManagerService.java6
7 files changed, 65 insertions, 30 deletions
diff --git a/services/java/com/android/server/IntentResolver.java b/services/java/com/android/server/IntentResolver.java
index 54aa50c..64b0487 100644
--- a/services/java/com/android/server/IntentResolver.java
+++ b/services/java/com/android/server/IntentResolver.java
@@ -38,6 +38,7 @@ import android.util.Printer;
import android.content.Intent;
import android.content.IntentFilter;
+import com.android.internal.util.FastPrintWriter;
/**
* {@hide}
@@ -229,8 +230,8 @@ public abstract class IntentResolver<F extends IntentFilter, R extends Object> {
((intent.getFlags() & Intent.FLAG_DEBUG_LOG_RESOLUTION) != 0);
if (debug) Slog.v(
- TAG, "Resolving type " + resolvedType + " scheme " + scheme
- + " of intent " + intent);
+ TAG, "Resolving type=" + resolvedType + " scheme=" + scheme
+ + " defaultOnly=" + defaultOnly + " userId=" + userId + " of " + intent);
F[] firstTypeCut = null;
F[] secondTypeCut = null;
@@ -312,8 +313,8 @@ public abstract class IntentResolver<F extends IntentFilter, R extends Object> {
if (debug) {
Slog.v(TAG, "Final result list:");
- for (R r : finalList) {
- Slog.v(TAG, " " + r);
+ for (int i=0; i<finalList.size(); i++) {
+ Slog.v(TAG, " " + finalList.get(i));
}
}
return finalList;
@@ -521,6 +522,16 @@ public abstract class IntentResolver<F extends IntentFilter, R extends Object> {
final boolean excludingStopped = intent.isExcludingStopped();
+ final Printer logPrinter;
+ final PrintWriter logPrintWriter;
+ if (debug) {
+ logPrinter = new LogPrinter(Log.VERBOSE, TAG, Log.LOG_ID_SYSTEM);
+ logPrintWriter = new FastPrintWriter(logPrinter);
+ } else {
+ logPrinter = null;
+ logPrintWriter = null;
+ }
+
final int N = src != null ? src.length : 0;
boolean hasNonDefaults = false;
int i;
@@ -555,11 +566,17 @@ public abstract class IntentResolver<F extends IntentFilter, R extends Object> {
match = filter.match(action, resolvedType, scheme, data, categories, TAG);
if (match >= 0) {
if (debug) Slog.v(TAG, " Filter matched! match=0x" +
- Integer.toHexString(match));
+ Integer.toHexString(match) + " hasDefault="
+ + filter.hasCategory(Intent.CATEGORY_DEFAULT));
if (!defaultOnly || filter.hasCategory(Intent.CATEGORY_DEFAULT)) {
final R oneResult = newResult(filter, match, userId);
if (oneResult != null) {
dest.add(oneResult);
+ if (debug) {
+ dumpFilter(logPrintWriter, " ", filter);
+ logPrintWriter.flush();
+ filter.dump(logPrinter, " ");
+ }
}
} else {
hasNonDefaults = true;
@@ -579,8 +596,12 @@ public abstract class IntentResolver<F extends IntentFilter, R extends Object> {
}
}
- if (dest.size() == 0 && hasNonDefaults) {
- Slog.w(TAG, "resolveIntent failed: found match, but none with Intent.CATEGORY_DEFAULT");
+ if (hasNonDefaults) {
+ if (dest.size() == 0) {
+ Slog.w(TAG, "resolveIntent failed: found match, but none with CATEGORY_DEFAULT");
+ } else if (dest.size() > 1) {
+ Slog.w(TAG, "resolveIntent: multiple matches, only some with CATEGORY_DEFAULT");
+ }
}
}
diff --git a/services/java/com/android/server/PreferredComponent.java b/services/java/com/android/server/PreferredComponent.java
index 134b198..a7af252 100644
--- a/services/java/com/android/server/PreferredComponent.java
+++ b/services/java/com/android/server/PreferredComponent.java
@@ -80,7 +80,7 @@ public class PreferredComponent {
}
myPackages[i] = cn.getPackageName().intern();
myClasses[i] = cn.getClassName().intern();
- myComponents[i] = cn.flattenToShortString().intern();
+ myComponents[i] = cn.flattenToShortString();
}
mSetPackages = myPackages;
mSetClasses = myClasses;
@@ -219,9 +219,10 @@ public class PreferredComponent {
out.print(prefix); out.print(
Integer.toHexString(System.identityHashCode(ident)));
out.print(' ');
- out.print(mComponent.flattenToShortString());
- out.print(" match=0x");
- out.println( Integer.toHexString(mMatch));
+ out.println(mShortComponent);
+ out.print(prefix); out.print(" mMatch=0x");
+ out.print(Integer.toHexString(mMatch));
+ out.print(" mAlways="); out.println(mAlways);
if (mSetComponents != null) {
out.print(prefix); out.println(" Selected from:");
for (int i=0; i<mSetComponents.length; i++) {
diff --git a/services/java/com/android/server/am/ActivityManagerService.java b/services/java/com/android/server/am/ActivityManagerService.java
index 327c854..4f73588 100644
--- a/services/java/com/android/server/am/ActivityManagerService.java
+++ b/services/java/com/android/server/am/ActivityManagerService.java
@@ -2355,7 +2355,8 @@ public final class ActivityManagerService extends ActivityManagerNative
}
killUnneededProcessLocked(proc, Long.toString(proc.lastCachedPss)
+ "k from cached");
- } else if (proc != null && !keepIfLarge && mLastMemoryLevel > ProcessStats.ADJ_MEM_FACTOR_NORMAL
+ } else if (proc != null && !keepIfLarge
+ && mLastMemoryLevel > ProcessStats.ADJ_MEM_FACTOR_NORMAL
&& proc.setProcState >= ActivityManager.PROCESS_STATE_CACHED_EMPTY) {
if (DEBUG_PSS) Slog.d(TAG, "May not keep " + proc + ": pss=" + proc.lastCachedPss);
if (proc.lastCachedPss >= mProcessList.getCachedRestoreThreshold()) {
diff --git a/services/java/com/android/server/pm/PackageManagerService.java b/services/java/com/android/server/pm/PackageManagerService.java
index f221598..6cf3223 100755
--- a/services/java/com/android/server/pm/PackageManagerService.java
+++ b/services/java/com/android/server/pm/PackageManagerService.java
@@ -5713,7 +5713,7 @@ public class PackageManagerService extends IPackageManager.Stub {
out.print(prefix); out.print(
Integer.toHexString(System.identityHashCode(filter.activity)));
out.print(' ');
- out.print(filter.activity.getComponentShortName());
+ filter.activity.printComponentShortName(out);
out.print(" filter ");
out.println(Integer.toHexString(System.identityHashCode(filter)));
}
@@ -5912,7 +5912,7 @@ public class PackageManagerService extends IPackageManager.Stub {
out.print(prefix); out.print(
Integer.toHexString(System.identityHashCode(filter.service)));
out.print(' ');
- out.print(filter.service.getComponentShortName());
+ filter.service.printComponentShortName(out);
out.print(" filter ");
out.println(Integer.toHexString(System.identityHashCode(filter)));
}
@@ -10423,7 +10423,7 @@ public class PackageManagerService extends IPackageManager.Stub {
dumpState.getTitlePrinted()
? "\nPreferred Activities User " + user + ":"
: "Preferred Activities User " + user + ":", " ",
- packageName, dumpState.isOptionEnabled(DumpState.OPTION_SHOW_FILTERS))) {
+ packageName, true)) {
dumpState.setTitlePrinted(true);
}
}
@@ -10467,7 +10467,7 @@ public class PackageManagerService extends IPackageManager.Stub {
pw.println("Registered ContentProviders:");
printedSomething = true;
}
- pw.print(" "); pw.print(p.getComponentShortName()); pw.println(":");
+ pw.print(" "); p.printComponentShortName(pw); pw.println(":");
pw.print(" "); pw.println(p.toString());
}
printedSomething = false;
diff --git a/services/java/com/android/server/print/RemotePrintService.java b/services/java/com/android/server/print/RemotePrintService.java
index a20973e..5b9dc28 100644
--- a/services/java/com/android/server/print/RemotePrintService.java
+++ b/services/java/com/android/server/print/RemotePrintService.java
@@ -85,7 +85,7 @@ final class RemotePrintService implements DeathRecipient {
private boolean mHasPrinterDiscoverySession;
- private boolean mServiceDead;
+ private boolean mServiceDied;
private List<PrinterId> mDiscoveryPriorityList;
@@ -107,7 +107,6 @@ final class RemotePrintService implements DeathRecipient {
mSpooler = spooler;
mHandler = new MyHandler(context.getMainLooper());
mPrintServiceClient = new RemotePrintServiceClient(this);
- mServiceDead = true;
}
public ComponentName getComponentName() {
@@ -157,7 +156,7 @@ final class RemotePrintService implements DeathRecipient {
private void handleBinderDied() {
mPrintService.asBinder().unlinkToDeath(this, 0);
mPrintService = null;
- mServiceDead = true;
+ mServiceDied = true;
mCallbacks.onServiceDied(this);
}
@@ -171,7 +170,7 @@ final class RemotePrintService implements DeathRecipient {
if (!isBound()) {
// The service is dead and neither has active jobs nor discovery
// session, so ensure we are unbound since the service has no work.
- if (mServiceDead && !mHasPrinterDiscoverySession) {
+ if (mServiceDied && !mHasPrinterDiscoverySession) {
ensureUnbound();
return;
}
@@ -286,7 +285,7 @@ final class RemotePrintService implements DeathRecipient {
if (!isBound()) {
// The service is dead and neither has active jobs nor discovery
// session, so ensure we are unbound since the service has no work.
- if (mServiceDead && !mHasActivePrintJobs) {
+ if (mServiceDied && !mHasActivePrintJobs) {
ensureUnbound();
return;
}
@@ -556,15 +555,15 @@ final class RemotePrintService implements DeathRecipient {
return;
}
// If the service died and there is a discovery session, recreate it.
- if (mServiceDead && mHasPrinterDiscoverySession) {
+ if (mServiceDied && mHasPrinterDiscoverySession) {
handleCreatePrinterDiscoverySession();
}
// If the service died and there is discovery started, restart it.
- if (mServiceDead && mDiscoveryPriorityList != null) {
+ if (mServiceDied && mDiscoveryPriorityList != null) {
handleStartPrinterDiscovery(mDiscoveryPriorityList);
}
// If the service died and printers were tracked, start tracking.
- if (mServiceDead && mTrackedPrinterList != null) {
+ if (mServiceDied && mTrackedPrinterList != null) {
final int trackedPrinterCount = mTrackedPrinterList.size();
for (int i = 0; i < trackedPrinterCount; i++) {
handleStartPrinterStateTracking(mTrackedPrinterList.get(i));
@@ -581,7 +580,7 @@ final class RemotePrintService implements DeathRecipient {
if (!mHasPrinterDiscoverySession && !mHasActivePrintJobs) {
ensureUnbound();
}
- mServiceDead = false;
+ mServiceDied = false;
}
@Override
diff --git a/services/java/com/android/server/print/UserState.java b/services/java/com/android/server/print/UserState.java
index fd4a3a4..8c21827 100644
--- a/services/java/com/android/server/print/UserState.java
+++ b/services/java/com/android/server/print/UserState.java
@@ -1007,12 +1007,25 @@ final class UserState implements PrintSpoolerCallbacks, PrintServiceCallbacks {
mHandler.obtainMessage(
SessionHandler.MSG_CREATE_PRINTER_DISCOVERY_SESSION,
service).sendToTarget();
- // If there are some observers that started discovery - tell the service.
- if (mDiscoveryObservers.getRegisteredCallbackCount() > 0) {
+ // Start printer discovery if necessary.
+ if (!mStartedPrinterDiscoveryTokens.isEmpty()) {
mHandler.obtainMessage(
SessionHandler.MSG_START_PRINTER_DISCOVERY,
service).sendToTarget();
}
+ // Start tracking printers if necessary
+ final int trackedPrinterCount = mStateTrackedPrinters.size();
+ for (int i = 0; i < trackedPrinterCount; i++) {
+ PrinterId printerId = mStateTrackedPrinters.get(i);
+ if (printerId.getServiceName().equals(service.getComponentName())) {
+ SomeArgs args = SomeArgs.obtain();
+ args.arg1 = service;
+ args.arg2 = printerId;
+ mHandler.obtainMessage(SessionHandler
+ .MSG_START_PRINTER_STATE_TRACKING, args)
+ .sendToTarget();
+ }
+ }
}
public void dump(PrintWriter pw, String prefix) {
diff --git a/services/java/com/android/server/wm/WindowManagerService.java b/services/java/com/android/server/wm/WindowManagerService.java
index 9d26670..e330f8b 100644
--- a/services/java/com/android/server/wm/WindowManagerService.java
+++ b/services/java/com/android/server/wm/WindowManagerService.java
@@ -416,6 +416,7 @@ public class WindowManagerService extends IWindowManager.Stub
int mFocusedStackLayer;
final float[] mTmpFloats = new float[9];
+ final Rect mTmpContentRect = new Rect();
boolean mDisplayReady;
boolean mSafeMode;
@@ -8172,9 +8173,8 @@ public class WindowManagerService extends IWindowManager.Stub
mScreenRect.set(0, 0, dw, dh);
}
- Rect contentRect = new Rect();
- mPolicy.getContentRectLw(contentRect);
- displayContent.setStackBoxSize(contentRect);
+ mPolicy.getContentRectLw(mTmpContentRect);
+ displayContent.setStackBoxSize(mTmpContentRect);
int seq = mLayoutSeq+1;
if (seq < 0) seq = 0;