Loading api/current.xml +1 −1 Original line number Diff line number Diff line Loading @@ -23748,7 +23748,7 @@ > <parameter name="parcel" type="android.os.Parcel"> </parameter> <parameter name="flags" type="int"> <parameter name="flagz" type="int"> </parameter> </method> <field name="CREATOR" core/java/android/app/ApplicationErrorReport.java +101 −1 Original line number Diff line number Diff line Loading @@ -16,8 +16,16 @@ package android.app; import android.content.ComponentName; import android.content.Context; import android.content.Intent; import android.content.pm.ApplicationInfo; import android.content.pm.PackageManager; import android.content.pm.ResolveInfo; import android.os.Parcel; import android.os.Parcelable; import android.os.SystemProperties; import android.provider.Settings; import android.util.Printer; import java.io.PrintWriter; import java.io.StringWriter; Loading @@ -38,6 +46,13 @@ import java.io.StringWriter; */ public class ApplicationErrorReport implements Parcelable { // System property defining error report receiver for system apps static final String SYSTEM_APPS_ERROR_RECEIVER_PROPERTY = "ro.error.receiver.system.apps"; // System property defining default error report receiver static final String DEFAULT_ERROR_RECEIVER_PROPERTY = "ro.error.receiver.default"; /** * Uninitialized error report. */ Loading @@ -53,9 +68,14 @@ public class ApplicationErrorReport implements Parcelable { */ public static final int TYPE_ANR = 2; /** * An error report about an application that's consuming too much battery. */ public static final int TYPE_BATTERY = 3; /** * Type of this report. Can be one of {@link #TYPE_NONE}, * {@link #TYPE_CRASH} or {@link #TYPE_ANR}. * {@link #TYPE_CRASH}, {@link #TYPE_ANR}, or {@link #TYPE_BATTERY}. */ public int type; Loading Loading @@ -98,6 +118,11 @@ public class ApplicationErrorReport implements Parcelable { */ public AnrInfo anrInfo; /** * Text containing battery usage data. */ public String batteryText; /** * Create an uninitialized instance of {@link ApplicationErrorReport}. */ Loading @@ -112,6 +137,68 @@ public class ApplicationErrorReport implements Parcelable { readFromParcel(in); } public static ComponentName getErrorReportReceiver(Context context, String packageName, int appFlags) { // check if error reporting is enabled in secure settings int enabled = Settings.Secure.getInt(context.getContentResolver(), Settings.Secure.SEND_ACTION_APP_ERROR, 0); if (enabled == 0) { return null; } PackageManager pm = context.getPackageManager(); // look for receiver in the installer package String candidate = pm.getInstallerPackageName(packageName); ComponentName result = getErrorReportReceiver(pm, packageName, candidate); if (result != null) { return result; } // if the error app is on the system image, look for system apps // error receiver if ((appFlags&ApplicationInfo.FLAG_SYSTEM) != 0) { candidate = SystemProperties.get(SYSTEM_APPS_ERROR_RECEIVER_PROPERTY); result = getErrorReportReceiver(pm, packageName, candidate); if (result != null) { return result; } } // if there is a default receiver, try that candidate = SystemProperties.get(DEFAULT_ERROR_RECEIVER_PROPERTY); return getErrorReportReceiver(pm, packageName, candidate); } /** * Return activity in receiverPackage that handles ACTION_APP_ERROR. * * @param pm PackageManager isntance * @param errorPackage package which caused the error * @param receiverPackage candidate package to receive the error * @return activity component within receiverPackage which handles * ACTION_APP_ERROR, or null if not found */ static ComponentName getErrorReportReceiver(PackageManager pm, String errorPackage, String receiverPackage) { if (receiverPackage == null || receiverPackage.length() == 0) { return null; } // break the loop if it's the error report receiver package that crashed if (receiverPackage.equals(errorPackage)) { return null; } Intent intent = new Intent(Intent.ACTION_APP_ERROR); intent.setPackage(receiverPackage); ResolveInfo info = pm.resolveActivity(intent, 0); if (info == null || info.activityInfo == null) { return null; } return new ComponentName(receiverPackage, info.activityInfo.name); } public void writeToParcel(Parcel dest, int flags) { dest.writeInt(type); dest.writeString(packageName); Loading @@ -127,6 +214,9 @@ public class ApplicationErrorReport implements Parcelable { case TYPE_ANR: anrInfo.writeToParcel(dest, flags); break; case TYPE_BATTERY: dest.writeString(batteryText); break; } } Loading @@ -142,10 +232,17 @@ public class ApplicationErrorReport implements Parcelable { case TYPE_CRASH: crashInfo = new CrashInfo(in); anrInfo = null; batteryText = null; break; case TYPE_ANR: anrInfo = new AnrInfo(in); crashInfo = null; batteryText = null; break; case TYPE_BATTERY: batteryText = in.readString(); anrInfo = null; crashInfo = null; break; } } Loading Loading @@ -347,6 +444,9 @@ public class ApplicationErrorReport implements Parcelable { case TYPE_ANR: anrInfo.dump(pw, prefix); break; case TYPE_BATTERY: pw.println(batteryText); break; } } } core/java/android/app/ContextImpl.java +1 −1 Original line number Diff line number Diff line Loading @@ -1146,7 +1146,7 @@ class ContextImpl extends Context { private DevicePolicyManager getDevicePolicyManager() { synchronized (mSync) { if (mDevicePolicyManager == null) { mDevicePolicyManager = new DevicePolicyManager(this, mDevicePolicyManager = DevicePolicyManager.create(this, mMainThread.getHandler()); } } Loading core/java/android/app/DeviceAdminInfo.java +14 −0 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ package android.app; import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParserException; import org.xmlpull.v1.XmlSerializer; import android.content.ComponentName; import android.content.Context; Loading Loading @@ -331,6 +332,19 @@ public final class DeviceAdminInfo implements Parcelable { return res; } /** @hide */ public void writePoliciesToXml(XmlSerializer out) throws IllegalArgumentException, IllegalStateException, IOException { out.attribute(null, "flags", Integer.toString(mUsesPolicies)); } /** @hide */ public void readPoliciesFromXml(XmlPullParser parser) throws XmlPullParserException, IOException { mUsesPolicies = Integer.parseInt( parser.getAttributeValue(null, "flags")); } public void dump(Printer pw, String prefix) { pw.println(prefix + "Receiver:"); mReceiver.dump(pw, prefix + " "); Loading core/java/android/app/DevicePolicyManager.java +20 −1 Original line number Diff line number Diff line Loading @@ -49,13 +49,18 @@ public class DevicePolicyManager { private final Handler mHandler; /*package*/ DevicePolicyManager(Context context, Handler handler) { private DevicePolicyManager(Context context, Handler handler) { mContext = context; mHandler = handler; mService = IDevicePolicyManager.Stub.asInterface( ServiceManager.getService(Context.DEVICE_POLICY_SERVICE)); } /*package*/ static DevicePolicyManager create(Context context, Handler handler) { DevicePolicyManager me = new DevicePolicyManager(context, handler); return me.mService != null ? me : null; } /** * Activity action: ask the user to add a new device administrator to the system. * The desired policy is the ComponentName of the policy in the Loading Loading @@ -132,6 +137,20 @@ public class DevicePolicyManager { return null; } /** * @hide */ public boolean packageHasActiveAdmins(String packageName) { if (mService != null) { try { return mService.packageHasActiveAdmins(packageName); } catch (RemoteException e) { Log.w(TAG, "Failed talking with device policy service", e); } } return false; } /** * Remove a current administration component. This can only be called * by the application that owns the administration component; if you Loading Loading
api/current.xml +1 −1 Original line number Diff line number Diff line Loading @@ -23748,7 +23748,7 @@ > <parameter name="parcel" type="android.os.Parcel"> </parameter> <parameter name="flags" type="int"> <parameter name="flagz" type="int"> </parameter> </method> <field name="CREATOR"
core/java/android/app/ApplicationErrorReport.java +101 −1 Original line number Diff line number Diff line Loading @@ -16,8 +16,16 @@ package android.app; import android.content.ComponentName; import android.content.Context; import android.content.Intent; import android.content.pm.ApplicationInfo; import android.content.pm.PackageManager; import android.content.pm.ResolveInfo; import android.os.Parcel; import android.os.Parcelable; import android.os.SystemProperties; import android.provider.Settings; import android.util.Printer; import java.io.PrintWriter; import java.io.StringWriter; Loading @@ -38,6 +46,13 @@ import java.io.StringWriter; */ public class ApplicationErrorReport implements Parcelable { // System property defining error report receiver for system apps static final String SYSTEM_APPS_ERROR_RECEIVER_PROPERTY = "ro.error.receiver.system.apps"; // System property defining default error report receiver static final String DEFAULT_ERROR_RECEIVER_PROPERTY = "ro.error.receiver.default"; /** * Uninitialized error report. */ Loading @@ -53,9 +68,14 @@ public class ApplicationErrorReport implements Parcelable { */ public static final int TYPE_ANR = 2; /** * An error report about an application that's consuming too much battery. */ public static final int TYPE_BATTERY = 3; /** * Type of this report. Can be one of {@link #TYPE_NONE}, * {@link #TYPE_CRASH} or {@link #TYPE_ANR}. * {@link #TYPE_CRASH}, {@link #TYPE_ANR}, or {@link #TYPE_BATTERY}. */ public int type; Loading Loading @@ -98,6 +118,11 @@ public class ApplicationErrorReport implements Parcelable { */ public AnrInfo anrInfo; /** * Text containing battery usage data. */ public String batteryText; /** * Create an uninitialized instance of {@link ApplicationErrorReport}. */ Loading @@ -112,6 +137,68 @@ public class ApplicationErrorReport implements Parcelable { readFromParcel(in); } public static ComponentName getErrorReportReceiver(Context context, String packageName, int appFlags) { // check if error reporting is enabled in secure settings int enabled = Settings.Secure.getInt(context.getContentResolver(), Settings.Secure.SEND_ACTION_APP_ERROR, 0); if (enabled == 0) { return null; } PackageManager pm = context.getPackageManager(); // look for receiver in the installer package String candidate = pm.getInstallerPackageName(packageName); ComponentName result = getErrorReportReceiver(pm, packageName, candidate); if (result != null) { return result; } // if the error app is on the system image, look for system apps // error receiver if ((appFlags&ApplicationInfo.FLAG_SYSTEM) != 0) { candidate = SystemProperties.get(SYSTEM_APPS_ERROR_RECEIVER_PROPERTY); result = getErrorReportReceiver(pm, packageName, candidate); if (result != null) { return result; } } // if there is a default receiver, try that candidate = SystemProperties.get(DEFAULT_ERROR_RECEIVER_PROPERTY); return getErrorReportReceiver(pm, packageName, candidate); } /** * Return activity in receiverPackage that handles ACTION_APP_ERROR. * * @param pm PackageManager isntance * @param errorPackage package which caused the error * @param receiverPackage candidate package to receive the error * @return activity component within receiverPackage which handles * ACTION_APP_ERROR, or null if not found */ static ComponentName getErrorReportReceiver(PackageManager pm, String errorPackage, String receiverPackage) { if (receiverPackage == null || receiverPackage.length() == 0) { return null; } // break the loop if it's the error report receiver package that crashed if (receiverPackage.equals(errorPackage)) { return null; } Intent intent = new Intent(Intent.ACTION_APP_ERROR); intent.setPackage(receiverPackage); ResolveInfo info = pm.resolveActivity(intent, 0); if (info == null || info.activityInfo == null) { return null; } return new ComponentName(receiverPackage, info.activityInfo.name); } public void writeToParcel(Parcel dest, int flags) { dest.writeInt(type); dest.writeString(packageName); Loading @@ -127,6 +214,9 @@ public class ApplicationErrorReport implements Parcelable { case TYPE_ANR: anrInfo.writeToParcel(dest, flags); break; case TYPE_BATTERY: dest.writeString(batteryText); break; } } Loading @@ -142,10 +232,17 @@ public class ApplicationErrorReport implements Parcelable { case TYPE_CRASH: crashInfo = new CrashInfo(in); anrInfo = null; batteryText = null; break; case TYPE_ANR: anrInfo = new AnrInfo(in); crashInfo = null; batteryText = null; break; case TYPE_BATTERY: batteryText = in.readString(); anrInfo = null; crashInfo = null; break; } } Loading Loading @@ -347,6 +444,9 @@ public class ApplicationErrorReport implements Parcelable { case TYPE_ANR: anrInfo.dump(pw, prefix); break; case TYPE_BATTERY: pw.println(batteryText); break; } } }
core/java/android/app/ContextImpl.java +1 −1 Original line number Diff line number Diff line Loading @@ -1146,7 +1146,7 @@ class ContextImpl extends Context { private DevicePolicyManager getDevicePolicyManager() { synchronized (mSync) { if (mDevicePolicyManager == null) { mDevicePolicyManager = new DevicePolicyManager(this, mDevicePolicyManager = DevicePolicyManager.create(this, mMainThread.getHandler()); } } Loading
core/java/android/app/DeviceAdminInfo.java +14 −0 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ package android.app; import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParserException; import org.xmlpull.v1.XmlSerializer; import android.content.ComponentName; import android.content.Context; Loading Loading @@ -331,6 +332,19 @@ public final class DeviceAdminInfo implements Parcelable { return res; } /** @hide */ public void writePoliciesToXml(XmlSerializer out) throws IllegalArgumentException, IllegalStateException, IOException { out.attribute(null, "flags", Integer.toString(mUsesPolicies)); } /** @hide */ public void readPoliciesFromXml(XmlPullParser parser) throws XmlPullParserException, IOException { mUsesPolicies = Integer.parseInt( parser.getAttributeValue(null, "flags")); } public void dump(Printer pw, String prefix) { pw.println(prefix + "Receiver:"); mReceiver.dump(pw, prefix + " "); Loading
core/java/android/app/DevicePolicyManager.java +20 −1 Original line number Diff line number Diff line Loading @@ -49,13 +49,18 @@ public class DevicePolicyManager { private final Handler mHandler; /*package*/ DevicePolicyManager(Context context, Handler handler) { private DevicePolicyManager(Context context, Handler handler) { mContext = context; mHandler = handler; mService = IDevicePolicyManager.Stub.asInterface( ServiceManager.getService(Context.DEVICE_POLICY_SERVICE)); } /*package*/ static DevicePolicyManager create(Context context, Handler handler) { DevicePolicyManager me = new DevicePolicyManager(context, handler); return me.mService != null ? me : null; } /** * Activity action: ask the user to add a new device administrator to the system. * The desired policy is the ComponentName of the policy in the Loading Loading @@ -132,6 +137,20 @@ public class DevicePolicyManager { return null; } /** * @hide */ public boolean packageHasActiveAdmins(String packageName) { if (mService != null) { try { return mService.packageHasActiveAdmins(packageName); } catch (RemoteException e) { Log.w(TAG, "Failed talking with device policy service", e); } } return false; } /** * Remove a current administration component. This can only be called * by the application that owns the administration component; if you Loading