Merge "Rub in a little 'ol log-b-gone." into gingerbread

This commit is contained in:
Dianne Hackborn
2010-09-30 19:03:38 -07:00
committed by Android (Google) Code Review
16 changed files with 324 additions and 158 deletions

View File

@@ -3262,7 +3262,7 @@ public final class ActivityThread {
while (i.hasNext()) {
ProviderInfo cpi = i.next();
StringBuilder buf = new StringBuilder(128);
buf.append("Publishing provider ");
buf.append("Pub ");
buf.append(cpi.authority);
buf.append(": ");
buf.append(cpi.name);

View File

@@ -1717,6 +1717,11 @@ public class PackageParser {
XmlUtils.skipCurrentTag(parser);
} else if (tagName.equals("uses-package")) {
// Dependencies for app installers; we don't currently try to
// enforce this.
XmlUtils.skipCurrentTag(parser);
} else {
if (!RIGID_PARSER) {
Log.w(TAG, "Unknown element under <application>: " + tagName

View File

@@ -42,7 +42,7 @@ import android.text.TextUtils;
public class MobileDataStateTracker extends NetworkStateTracker {
private static final String TAG = "MobileDataStateTracker";
private static final boolean DBG = true;
private static final boolean DBG = false;
private Phone.DataState mMobileDataState;
private ITelephony mPhoneService;

View File

@@ -47,7 +47,7 @@ public abstract class NetworkStateTracker extends Handler {
protected int mDefaultGatewayAddr;
private boolean mTeardownRequested;
private static boolean DBG = true;
private static boolean DBG = false;
private static final String TAG = "NetworkStateTracker";
// Share the event space with ConnectivityService (which we can't see, but
@@ -186,7 +186,7 @@ public abstract class NetworkStateTracker extends Handler {
String bufferSizes = SystemProperties.get(key);
if (bufferSizes.length() == 0) {
Log.e(TAG, key + " not found in system properties. Using defaults");
Log.w(TAG, key + " not found in system properties. Using defaults");
// Setting to default values so we won't be stuck to previous values
key = "net.tcp.buffersize.default";
@@ -230,10 +230,10 @@ public abstract class NetworkStateTracker extends Handler {
stringToFile(prefix + "wmem_def", values[4]);
stringToFile(prefix + "wmem_max", values[5]);
} else {
Log.e(TAG, "Invalid buffersize string: " + bufferSizes);
Log.w(TAG, "Invalid buffersize string: " + bufferSizes);
}
} catch (IOException e) {
Log.e(TAG, "Can't set tcp buffer sizes:" + e);
Log.w(TAG, "Can't set tcp buffer sizes:" + e);
}
}

View File

@@ -71,20 +71,6 @@
<item>@drawable/indicator_code_lock_point_area_default</item>
<item>@drawable/indicator_code_lock_point_area_green</item>
<item>@drawable/indicator_code_lock_point_area_red</item>
<!-- SlidingTab drawables shared by InCallScreen and LockScreen -->
<item>@drawable/jog_tab_bar_left_end_confirm_gray</item>
<item>@drawable/jog_tab_bar_left_end_normal</item>
<item>@drawable/jog_tab_bar_left_end_pressed</item>
<item>@drawable/jog_tab_bar_right_end_confirm_gray</item>
<item>@drawable/jog_tab_bar_right_end_normal</item>
<item>@drawable/jog_tab_bar_right_end_pressed</item>
<item>@drawable/jog_tab_left_confirm_gray</item>
<item>@drawable/jog_tab_left_normal</item>
<item>@drawable/jog_tab_left_pressed</item>
<item>@drawable/jog_tab_right_confirm_gray</item>
<item>@drawable/jog_tab_right_normal</item>
<item>@drawable/jog_tab_right_pressed</item>
<item>@drawable/jog_tab_target_gray</item>
</array>
<!-- Do not translate. These are all of the color state list resources that should be

View File

@@ -56,7 +56,7 @@ import java.util.List;
*/
public class ConnectivityService extends IConnectivityManager.Stub {
private static final boolean DBG = true;
private static final boolean DBG = false;
private static final String TAG = "ConnectivityService";
// how long to wait before switching back to a radio's default network

View File

@@ -55,6 +55,7 @@ import android.view.WindowManagerPolicy;
import java.io.File;
import java.io.FileDescriptor;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.PrintWriter;
@@ -451,6 +452,8 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
Slog.w(TAG, "failed parsing " + file + " " + e);
} catch (XmlPullParserException e) {
Slog.w(TAG, "failed parsing " + file + " " + e);
} catch (FileNotFoundException e) {
// Don't be noisy, this is normal if we haven't defined any policies.
} catch (IOException e) {
Slog.w(TAG, "failed parsing " + file + " " + e);
} catch (IndexOutOfBoundsException e) {

View File

@@ -936,10 +936,11 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
}
public void updateStatusIcon(IBinder token, String packageName, int iconId) {
int uid = Binder.getCallingUid();
long ident = Binder.clearCallingIdentity();
try {
if (token == null || mCurToken != token) {
Slog.w(TAG, "Ignoring setInputMethod of token: " + token);
Slog.w(TAG, "Ignoring setInputMethod of uid " + uid + " token: " + token);
return;
}
@@ -1010,6 +1011,7 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
public boolean showSoftInput(IInputMethodClient client, int flags,
ResultReceiver resultReceiver) {
int uid = Binder.getCallingUid();
long ident = Binder.clearCallingIdentity();
try {
synchronized (mMethodMap) {
@@ -1020,7 +1022,7 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
// focus in the window manager, to allow this call to
// be made before input is started in it.
if (!mIWindowManager.inputMethodClientHasFocus(client)) {
Slog.w(TAG, "Ignoring showSoftInput of: " + client);
Slog.w(TAG, "Ignoring showSoftInput of uid " + uid + ": " + client);
return false;
}
} catch (RemoteException e) {
@@ -1074,6 +1076,7 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
public boolean hideSoftInput(IInputMethodClient client, int flags,
ResultReceiver resultReceiver) {
int uid = Binder.getCallingUid();
long ident = Binder.clearCallingIdentity();
try {
synchronized (mMethodMap) {
@@ -1084,7 +1087,8 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
// focus in the window manager, to allow this call to
// be made before input is started in it.
if (!mIWindowManager.inputMethodClientHasFocus(client)) {
Slog.w(TAG, "Ignoring hideSoftInput of: " + client);
if (DEBUG) Slog.w(TAG, "Ignoring hideSoftInput of uid "
+ uid + ": " + client);
return false;
}
} catch (RemoteException e) {
@@ -1219,7 +1223,8 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
synchronized (mMethodMap) {
if (mCurClient == null || client == null
|| mCurClient.client.asBinder() != client.asBinder()) {
Slog.w(TAG, "Ignoring showInputMethodDialogFromClient of: " + client);
Slog.w(TAG, "Ignoring showInputMethodDialogFromClient of uid "
+ Binder.getCallingUid() + ": " + client);
}
mHandler.sendEmptyMessage(MSG_SHOW_IM_PICKER);
@@ -1237,7 +1242,8 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
+ android.Manifest.permission.WRITE_SECURE_SETTINGS);
}
} else if (mCurToken != token) {
Slog.w(TAG, "Ignoring setInputMethod of token: " + token);
Slog.w(TAG, "Ignoring setInputMethod of uid " + Binder.getCallingUid()
+ " token: " + token);
return;
}
@@ -1253,7 +1259,8 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
public void hideMySoftInput(IBinder token, int flags) {
synchronized (mMethodMap) {
if (token == null || mCurToken != token) {
Slog.w(TAG, "Ignoring hideInputMethod of token: " + token);
if (DEBUG) Slog.w(TAG, "Ignoring hideInputMethod of uid "
+ Binder.getCallingUid() + " token: " + token);
return;
}
long ident = Binder.clearCallingIdentity();
@@ -1268,7 +1275,8 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
public void showMySoftInput(IBinder token, int flags) {
synchronized (mMethodMap) {
if (token == null || mCurToken != token) {
Slog.w(TAG, "Ignoring hideInputMethod of token: " + token);
Slog.w(TAG, "Ignoring showMySoftInput of uid "
+ Binder.getCallingUid() + " token: " + token);
return;
}
long ident = Binder.clearCallingIdentity();

View File

@@ -28,6 +28,7 @@ import java.util.Map;
import java.util.Set;
import android.util.Log;
import android.util.PrintWriterPrinter;
import android.util.Slog;
import android.util.LogPrinter;
import android.util.Printer;
@@ -92,10 +93,12 @@ public class IntentResolver<F extends IntentFilter, R extends Object> {
}
boolean dumpMap(PrintWriter out, String titlePrefix, String title,
String prefix, Map<String, ArrayList<F>> map, String packageName) {
String prefix, Map<String, ArrayList<F>> map, String packageName,
boolean printFilter) {
String eprefix = prefix + " ";
String fprefix = prefix + " ";
boolean printedSomething = false;
Printer printer = null;
for (Map.Entry<String, ArrayList<F>> e : map.entrySet()) {
ArrayList<F> a = e.getValue();
final int N = a.size();
@@ -115,37 +118,44 @@ public class IntentResolver<F extends IntentFilter, R extends Object> {
}
printedSomething = true;
dumpFilter(out, fprefix, filter);
if (printFilter) {
if (printer == null) {
printer = new PrintWriterPrinter(out);
}
filter.dump(printer, fprefix + " ");
}
}
}
return printedSomething;
}
public boolean dump(PrintWriter out, String title, String prefix, String packageName) {
public boolean dump(PrintWriter out, String title, String prefix, String packageName,
boolean printFilter) {
String innerPrefix = prefix + " ";
String sepPrefix = "\n" + prefix;
String curPrefix = title + "\n" + prefix;
if (dumpMap(out, curPrefix, "Full MIME Types:", innerPrefix,
mTypeToFilter, packageName)) {
mTypeToFilter, packageName, printFilter)) {
curPrefix = sepPrefix;
}
if (dumpMap(out, curPrefix, "Base MIME Types:", innerPrefix,
mBaseTypeToFilter, packageName)) {
mBaseTypeToFilter, packageName, printFilter)) {
curPrefix = sepPrefix;
}
if (dumpMap(out, curPrefix, "Wild MIME Types:", innerPrefix,
mWildTypeToFilter, packageName)) {
mWildTypeToFilter, packageName, printFilter)) {
curPrefix = sepPrefix;
}
if (dumpMap(out, curPrefix, "Schemes:", innerPrefix,
mSchemeToFilter, packageName)) {
mSchemeToFilter, packageName, printFilter)) {
curPrefix = sepPrefix;
}
if (dumpMap(out, curPrefix, "Non-Data Actions:", innerPrefix,
mActionToFilter, packageName)) {
mActionToFilter, packageName, printFilter)) {
curPrefix = sepPrefix;
}
if (dumpMap(out, curPrefix, "MIME Typed Actions:", innerPrefix,
mTypedActionToFilter, packageName)) {
mTypedActionToFilter, packageName, printFilter)) {
curPrefix = sepPrefix;
}
return curPrefix == sepPrefix;

View File

@@ -55,7 +55,7 @@ import java.util.concurrent.CountDownLatch;
class NetworkManagementService extends INetworkManagementService.Stub {
private static final String TAG = "NetworkManagmentService";
private static final boolean DBG = true;
private static final boolean DBG = false;
private static final String NETD_TAG = "NetdConnector";
class NetdResponseCode {

View File

@@ -1102,27 +1102,6 @@ class PackageManagerService extends IPackageManager.Stub {
final File permFile = new File(Environment.getRootDirectory(),
"etc/permissions/platform.xml");
readPermissionsFromXml(permFile);
StringBuilder sb = new StringBuilder(128);
sb.append("Libs:");
Iterator<String> it = mSharedLibraries.keySet().iterator();
while (it.hasNext()) {
sb.append(' ');
String name = it.next();
sb.append(name);
sb.append(':');
sb.append(mSharedLibraries.get(name));
}
Log.i(TAG, sb.toString());
sb.setLength(0);
sb.append("Features:");
it = mAvailableFeatures.keySet().iterator();
while (it.hasNext()) {
sb.append(' ');
sb.append(it.next());
}
Log.i(TAG, sb.toString());
}
private void readPermissionsFromXml(File permFile) {
@@ -2632,7 +2611,7 @@ class PackageManagerService extends IPackageManager.Stub {
// The system package has been updated and the code path does not match
// Ignore entry. Skip it.
Log.i(TAG, "Package " + ps.name + " at " + scanFile
+ "ignored: updated version " + ps.versionCode
+ " ignored: updated version " + ps.versionCode
+ " better than this " + pkg.mVersionCode);
mLastScanError = PackageManager.INSTALL_FAILED_DUPLICATE_PACKAGE;
return null;
@@ -6866,7 +6845,18 @@ class PackageManagerService extends IPackageManager.Stub {
return;
}
boolean dumpStar = true;
boolean dumpLibs = false;
boolean dumpFeatures = false;
boolean dumpResolvers = false;
boolean dumpPermissions = false;
boolean dumpPackages = false;
boolean dumpSharedUsers = false;
boolean dumpMessages = false;
boolean dumpProviders = false;
String packageName = null;
boolean showFilters = false;
int opti = 0;
while (opti < args.length) {
@@ -6879,10 +6869,22 @@ class PackageManagerService extends IPackageManager.Stub {
// Right now we only know how to print all.
} else if ("-h".equals(opt)) {
pw.println("Package manager dump options:");
pw.println(" [-h] [cmd] ...");
pw.println(" [-h] [-f] [cmd] ...");
pw.println(" -f: print details of intent filters");
pw.println(" -h: print this help");
pw.println(" cmd may be one of:");
pw.println(" [package.name]: info about given package");
pw.println(" l[ibraries]: list known shared libraries");
pw.println(" f[ibraries]: list device features");
pw.println(" r[esolvers]: dump intent resolvers");
pw.println(" perm[issions]: dump permissions");
pw.println(" prov[iders]: dump content providers");
pw.println(" p[ackages]: dump installed packages");
pw.println(" s[hared-users]: dump shared user IDs");
pw.println(" m[essages]: print collected runtime messages");
pw.println(" <package.name>: info about given package");
return;
} else if ("-f".equals(opt)) {
showFilters = true;
} else {
pw.println("Unknown argument: " + opt + "; use -h for help");
}
@@ -6895,32 +6897,87 @@ class PackageManagerService extends IPackageManager.Stub {
// Is this a package name?
if ("android".equals(cmd) || cmd.contains(".")) {
packageName = cmd;
} else if ("l".equals(cmd) || "libraries".equals(cmd)) {
dumpStar = false;
dumpLibs = true;
} else if ("f".equals(cmd) || "features".equals(cmd)) {
dumpStar = false;
dumpFeatures = true;
} else if ("r".equals(cmd) || "resolvers".equals(cmd)) {
dumpStar = false;
dumpResolvers = true;
} else if ("perm".equals(cmd) || "permissions".equals(cmd)) {
dumpStar = false;
dumpPermissions = true;
} else if ("p".equals(cmd) || "packages".equals(cmd)) {
dumpStar = false;
dumpPackages = true;
} else if ("s".equals(cmd) || "shared-users".equals(cmd)) {
dumpStar = false;
dumpSharedUsers = true;
} else if ("prov".equals(cmd) || "providers".equals(cmd)) {
dumpStar = false;
dumpProviders = true;
} else if ("m".equals(cmd) || "messages".equals(cmd)) {
dumpStar = false;
dumpMessages = true;
}
}
boolean printedTitle = false;
synchronized (mPackages) {
if (mActivities.dump(pw, "Activity Resolver Table:", " ", packageName)) {
if ((dumpStar || dumpLibs) && packageName == null) {
if (printedTitle) pw.println(" ");
printedTitle = true;
pw.println("Libraries:");
Iterator<String> it = mSharedLibraries.keySet().iterator();
while (it.hasNext()) {
String name = it.next();
pw.print(" ");
pw.print(name);
pw.print(" -> ");
pw.println(mSharedLibraries.get(name));
}
}
if (mReceivers.dump(pw, printedTitle
? "\nReceiver Resolver Table:" : "Receiver Resolver Table:",
" ", packageName)) {
if ((dumpStar || dumpFeatures) && packageName == null) {
if (printedTitle) pw.println(" ");
printedTitle = true;
pw.println("Features:");
Iterator<String> it = mAvailableFeatures.keySet().iterator();
while (it.hasNext()) {
String name = it.next();
pw.print(" ");
pw.println(name);
}
}
if (mServices.dump(pw, printedTitle
? "\nService Resolver Table:" : "Service Resolver Table:",
" ", packageName)) {
printedTitle = true;
}
if (mSettings.mPreferredActivities.dump(pw, printedTitle
? "\nPreferred Activities:" : "Preferred Activities:",
" ", packageName)) {
printedTitle = true;
if (dumpStar || dumpResolvers) {
if (mActivities.dump(pw, printedTitle
? "\nActivity Resolver Table:" : "Activity Resolver Table:",
" ", packageName, showFilters)) {
printedTitle = true;
}
if (mReceivers.dump(pw, printedTitle
? "\nReceiver Resolver Table:" : "Receiver Resolver Table:",
" ", packageName, showFilters)) {
printedTitle = true;
}
if (mServices.dump(pw, printedTitle
? "\nService Resolver Table:" : "Service Resolver Table:",
" ", packageName, showFilters)) {
printedTitle = true;
}
if (mSettings.mPreferredActivities.dump(pw, printedTitle
? "\nPreferred Activities:" : "Preferred Activities:",
" ", packageName, showFilters)) {
printedTitle = true;
}
}
boolean printedSomething = false;
{
if (dumpStar || dumpPermissions) {
for (BasePermission p : mSettings.mPermissions.values()) {
if (packageName != null && !packageName.equals(p.sourcePackage)) {
continue;
@@ -6947,9 +7004,27 @@ class PackageManagerService extends IPackageManager.Stub {
}
}
}
if (dumpStar || dumpProviders) {
printedSomething = false;
for (PackageParser.Provider p : mProviders.values()) {
if (packageName != null && !packageName.equals(p.info.packageName)) {
continue;
}
if (!printedSomething) {
if (printedTitle) pw.println(" ");
pw.println("Registered ContentProviders:");
printedSomething = true;
printedTitle = true;
}
pw.print(" ["); pw.print(p.info.authority); pw.print("]: ");
pw.println(p.toString());
}
}
printedSomething = false;
SharedUserSetting packageSharedUser = null;
{
if (dumpStar || dumpPackages) {
for (PackageSetting ps : mSettings.mPackages.values()) {
if (packageName != null && !packageName.equals(ps.realName)
&& !packageName.equals(ps.name)) {
@@ -7052,52 +7127,54 @@ class PackageManagerService extends IPackageManager.Stub {
}
}
printedSomething = false;
if (mSettings.mRenamedPackages.size() > 0) {
for (HashMap.Entry<String, String> e
: mSettings.mRenamedPackages.entrySet()) {
if (packageName != null && !packageName.equals(e.getKey())
&& !packageName.equals(e.getValue())) {
continue;
if (dumpStar || dumpPackages) {
if (mSettings.mRenamedPackages.size() > 0) {
for (HashMap.Entry<String, String> e
: mSettings.mRenamedPackages.entrySet()) {
if (packageName != null && !packageName.equals(e.getKey())
&& !packageName.equals(e.getValue())) {
continue;
}
if (!printedSomething) {
if (printedTitle) pw.println(" ");
pw.println("Renamed packages:");
printedSomething = true;
printedTitle = true;
}
pw.print(" "); pw.print(e.getKey()); pw.print(" -> ");
pw.println(e.getValue());
}
if (!printedSomething) {
if (printedTitle) pw.println(" ");
pw.println("Renamed packages:");
printedSomething = true;
printedTitle = true;
}
printedSomething = false;
if (mSettings.mDisabledSysPackages.size() > 0) {
for (PackageSetting ps : mSettings.mDisabledSysPackages.values()) {
if (packageName != null && !packageName.equals(ps.realName)
&& !packageName.equals(ps.name)) {
continue;
}
if (!printedSomething) {
if (printedTitle) pw.println(" ");
pw.println("Hidden system packages:");
printedSomething = true;
printedTitle = true;
}
pw.print(" Package [");
pw.print(ps.realName != null ? ps.realName : ps.name);
pw.print("] (");
pw.print(Integer.toHexString(System.identityHashCode(ps)));
pw.println("):");
if (ps.realName != null) {
pw.print(" compat name="); pw.println(ps.name);
}
pw.print(" userId="); pw.println(ps.userId);
pw.print(" sharedUser="); pw.println(ps.sharedUser);
pw.print(" codePath="); pw.println(ps.codePathString);
pw.print(" resourcePath="); pw.println(ps.resourcePathString);
}
pw.print(" "); pw.print(e.getKey()); pw.print(" -> ");
pw.println(e.getValue());
}
}
printedSomething = false;
if (mSettings.mDisabledSysPackages.size() > 0) {
for (PackageSetting ps : mSettings.mDisabledSysPackages.values()) {
if (packageName != null && !packageName.equals(ps.realName)
&& !packageName.equals(ps.name)) {
continue;
}
if (!printedSomething) {
if (printedTitle) pw.println(" ");
pw.println("Hidden system packages:");
printedSomething = true;
printedTitle = true;
}
pw.print(" Package [");
pw.print(ps.realName != null ? ps.realName : ps.name);
pw.print("] (");
pw.print(Integer.toHexString(System.identityHashCode(ps)));
pw.println("):");
if (ps.realName != null) {
pw.print(" compat name="); pw.println(ps.name);
}
pw.print(" userId="); pw.println(ps.userId);
pw.print(" sharedUser="); pw.println(ps.sharedUser);
pw.print(" codePath="); pw.println(ps.codePathString);
pw.print(" resourcePath="); pw.println(ps.resourcePathString);
}
}
printedSomething = false;
{
if (dumpStar || dumpSharedUsers) {
for (SharedUserSetting su : mSettings.mSharedUsers.values()) {
if (packageName != null && su != packageSharedUser) {
continue;
@@ -7120,11 +7197,11 @@ class PackageManagerService extends IPackageManager.Stub {
}
}
if (packageName == null) {
if ((dumpStar || dumpMessages) && packageName == null) {
if (printedTitle) pw.println(" ");
printedTitle = true;
pw.println("Settings parse messages:");
pw.println(mSettings.mReadMessages.toString());
pw.print(mSettings.mReadMessages.toString());
pw.println(" ");
pw.println("Package warning messages:");
@@ -7135,29 +7212,12 @@ class PackageManagerService extends IPackageManager.Stub {
int avail = in.available();
byte[] data = new byte[avail];
in.read(data);
pw.println(new String(data));
pw.print(new String(data));
} catch (FileNotFoundException e) {
} catch (IOException e) {
}
}
}
synchronized (mProviders) {
boolean printedSomething = false;
for (PackageParser.Provider p : mProviders.values()) {
if (packageName != null && !packageName.equals(p.info.packageName)) {
continue;
}
if (!printedSomething) {
if (printedTitle) pw.println(" ");
pw.println("Registered ContentProviders:");
printedSomething = true;
printedTitle = true;
}
pw.print(" ["); pw.print(p.info.authority); pw.print("]: ");
pw.println(p.toString());
}
}
}
static final class BasePermission {

View File

@@ -112,9 +112,15 @@ import android.view.View;
import android.view.WindowManager;
import android.view.WindowManagerPolicy;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.File;
import java.io.FileDescriptor;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
@@ -6087,6 +6093,76 @@ public final class ActivityManagerService extends ActivityManagerNative
return mSystemReady;
}
private static File getCalledPreBootReceiversFile() {
File dataDir = Environment.getDataDirectory();
File systemDir = new File(dataDir, "system");
File fname = new File(systemDir, "called_pre_boots.dat");
return fname;
}
private static ArrayList<ComponentName> readLastDonePreBootReceivers() {
ArrayList<ComponentName> lastDoneReceivers = new ArrayList<ComponentName>();
File file = getCalledPreBootReceiversFile();
FileInputStream fis = null;
try {
fis = new FileInputStream(file);
DataInputStream dis = new DataInputStream(new BufferedInputStream(fis, 2048));
int vers = dis.readInt();
String codename = dis.readUTF();
if (vers == android.os.Build.VERSION.SDK_INT
&& codename.equals(android.os.Build.VERSION.CODENAME)) {
int num = dis.readInt();
while (num > 0) {
num--;
String pkg = dis.readUTF();
String cls = dis.readUTF();
lastDoneReceivers.add(new ComponentName(pkg, cls));
}
}
} catch (FileNotFoundException e) {
} catch (IOException e) {
Slog.w(TAG, "Failure reading last done pre-boot receivers", e);
} finally {
if (fis != null) {
try {
fis.close();
} catch (IOException e) {
}
}
}
return lastDoneReceivers;
}
private static void writeLastDonePreBootReceivers(ArrayList<ComponentName> list) {
File file = getCalledPreBootReceiversFile();
FileOutputStream fos = null;
DataOutputStream dos = null;
try {
Slog.i(TAG, "Writing new set of last done pre-boot receivers...");
fos = new FileOutputStream(file);
dos = new DataOutputStream(new BufferedOutputStream(fos, 2048));
dos.writeInt(android.os.Build.VERSION.SDK_INT);
dos.writeUTF(android.os.Build.VERSION.CODENAME);
dos.writeInt(list.size());
for (int i=0; i<list.size(); i++) {
dos.writeUTF(list.get(i).getPackageName());
dos.writeUTF(list.get(i).getClassName());
}
} catch (IOException e) {
Slog.w(TAG, "Failure writing last done pre-boot receivers", e);
file.delete();
} finally {
if (dos != null) {
try {
dos.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
}
public void systemReady(final Runnable goingCallback) {
// In the simulator, startRunning will never have been called, which
// normally sets a few crucial variables. Do it here instead.
@@ -6121,9 +6197,24 @@ public final class ActivityManagerService extends ActivityManagerNative
}
}
intent.addFlags(Intent.FLAG_RECEIVER_BOOT_UPGRADE);
ArrayList<ComponentName> lastDoneReceivers = readLastDonePreBootReceivers();
final ArrayList<ComponentName> doneReceivers = new ArrayList<ComponentName>();
for (int i=0; i<ris.size(); i++) {
ActivityInfo ai = ris.get(i).activityInfo;
intent.setComponent(new ComponentName(ai.packageName, ai.name));
ComponentName comp = new ComponentName(ai.packageName, ai.name);
if (lastDoneReceivers.contains(comp)) {
ris.remove(i);
i--;
}
}
for (int i=0; i<ris.size(); i++) {
ActivityInfo ai = ris.get(i).activityInfo;
ComponentName comp = new ComponentName(ai.packageName, ai.name);
doneReceivers.add(comp);
intent.setComponent(comp);
IIntentReceiver finisher = null;
if (i == ris.size()-1) {
finisher = new IIntentReceiver.Stub() {
@@ -6138,6 +6229,7 @@ public final class ActivityManagerService extends ActivityManagerNative
synchronized (ActivityManagerService.this) {
mDidUpdate = true;
}
writeLastDonePreBootReceivers(doneReceivers);
systemReady(goingCallback);
}
});
@@ -6177,19 +6269,19 @@ public final class ActivityManagerService extends ActivityManagerNative
}
}
if (procsToKill != null) {
synchronized(this) {
synchronized(this) {
if (procsToKill != null) {
for (int i=procsToKill.size()-1; i>=0; i--) {
ProcessRecord proc = procsToKill.get(i);
Slog.i(TAG, "Removing system update proc: " + proc);
removeProcessLocked(proc, true);
}
// Now that we have cleaned up any update processes, we
// are ready to start launching real processes and know that
// we won't trample on them any more.
mProcessesReady = true;
}
// Now that we have cleaned up any update processes, we
// are ready to start launching real processes and know that
// we won't trample on them any more.
mProcessesReady = true;
}
Slog.i(TAG, "System now ready");
@@ -7602,7 +7694,7 @@ public final class ActivityManagerService extends ActivityManagerNative
pw.println(" ");
pw.println("Receiver Resolver Table:");
mReceiverResolver.dump(pw, null, " ", null);
mReceiverResolver.dump(pw, null, " ", null, false);
needSep = true;
}

View File

@@ -439,10 +439,11 @@ class ActivityRecord extends IApplicationToken.Stub {
sb.append(shortComponentName);
sb.append(": ");
TimeUtils.formatDuration(thisTime, sb);
sb.append(" (total ");
TimeUtils.formatDuration(totalTime, sb);
sb.append(totalTime);
sb.append(")");
if (thisTime != totalTime) {
sb.append(" (total ");
TimeUtils.formatDuration(totalTime, sb);
sb.append(")");
}
Log.i(ActivityManagerService.TAG, sb.toString());
}
stack.reportActivityLaunchedLocked(false, this, thisTime, totalTime);

View File

@@ -1881,7 +1881,7 @@ public class ActivityStack {
String resultWho, int requestCode,
int callingPid, int callingUid, boolean onlyIfNeeded,
boolean componentSpecified) {
Slog.i(TAG, "Starting activity: " + intent);
Slog.i(TAG, "Starting: " + intent);
ActivityRecord sourceRecord = null;
ActivityRecord resultRecord = null;

View File

@@ -57,6 +57,7 @@ import java.util.concurrent.atomic.AtomicLong;
public final class UsageStatsService extends IUsageStats.Stub {
public static final String SERVICE_NAME = "usagestats";
private static final boolean localLOGV = false;
private static final boolean REPORT_UNEXPECTED = false;
private static final String TAG = "UsageStats";
// Current on-disk Parcel version
@@ -404,11 +405,11 @@ public final class UsageStatsService extends IUsageStats.Stub {
new Thread("UsageStatsService_DiskWriter") {
public void run() {
try {
Slog.d(TAG, "Disk writer thread starting.");
if (localLOGV) Slog.d(TAG, "Disk writer thread starting.");
writeStatsToFile(true);
} finally {
mUnforcedDiskWriteRunning.set(false);
Slog.d(TAG, "Disk writer thread ending.");
if (localLOGV) Slog.d(TAG, "Disk writer thread ending.");
}
}
}.start();
@@ -458,7 +459,7 @@ public final class UsageStatsService extends IUsageStats.Stub {
}
}
}
Slog.d(TAG, "Dumped usage stats.");
if (localLOGV) Slog.d(TAG, "Dumped usage stats.");
}
private void writeStatsFLOCK(File file) throws IOException {
@@ -493,7 +494,7 @@ public final class UsageStatsService extends IUsageStats.Stub {
}
public void shutdown() {
Slog.w(TAG, "Writing usage stats before shutdown...");
Slog.i(TAG, "Writing usage stats before shutdown...");
writeStatsToFile(true);
}
@@ -520,7 +521,7 @@ public final class UsageStatsService extends IUsageStats.Stub {
if (mLastResumedPkg != null) {
// We last resumed some other package... just pause it now
// to recover.
Slog.i(TAG, "Unexpected resume of " + pkgName
if (REPORT_UNEXPECTED) Slog.i(TAG, "Unexpected resume of " + pkgName
+ " while already resumed in " + mLastResumedPkg);
PkgUsageStatsExtended pus = mStats.get(mLastResumedPkg);
if (pus != null) {
@@ -559,7 +560,7 @@ public final class UsageStatsService extends IUsageStats.Stub {
return;
}
if (!mIsResumed) {
Slog.i(TAG, "Something wrong here, didn't expect "
if (REPORT_UNEXPECTED) Slog.i(TAG, "Something wrong here, didn't expect "
+ pkgName + " to be paused");
return;
}

View File

@@ -33,7 +33,7 @@ import java.util.ArrayList;
*
*/
public abstract class DataConnectionTracker extends Handler {
protected static final boolean DBG = true;
protected static final boolean DBG = false;
protected final String LOG_TAG = "DataConnectionTracker";
/**