Loading cmds/screencap/screencap.cpp +33 −5 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ #include <linux/fb.h> #include <sys/ioctl.h> #include <sys/mman.h> #include <sys/wait.h> #include <binder/ProcessState.h> Loading Loading @@ -99,11 +100,38 @@ static uint32_t dataSpaceToInt(ui::Dataspace d) } static status_t notifyMediaScanner(const char* fileName) { String8 cmd("am broadcast -a android.intent.action.MEDIA_SCANNER_SCAN_FILE -d file://"); cmd.append(fileName); cmd.append(" > /dev/null"); int result = system(cmd.string()); if (result < 0) { std::string filePath("file://"); filePath.append(fileName); char *cmd[] = { (char*) "am", (char*) "broadcast", (char*) "am", (char*) "android.intent.action.MEDIA_SCANNER_SCAN_FILE", (char*) "-d", &filePath[0], nullptr }; int status; int pid = fork(); if (pid < 0){ fprintf(stderr, "Unable to fork in order to send intent for media scanner.\n"); return UNKNOWN_ERROR; } if (pid == 0){ int fd = open("/dev/null", O_WRONLY); if (fd < 0){ fprintf(stderr, "Unable to open /dev/null for media scanner stdout redirection.\n"); exit(1); } dup2(fd, 1); int result = execvp(cmd[0], cmd); close(fd); exit(result); } wait(&status); if (status < 0) { fprintf(stderr, "Unable to broadcast intent for media scanner.\n"); return UNKNOWN_ERROR; } Loading core/java/android/bluetooth/BluetoothAdapter.java +4 −3 Original line number Diff line number Diff line Loading @@ -1196,10 +1196,11 @@ public final class BluetoothAdapter { public boolean factoryReset() { try { mServiceLock.readLock().lock(); if (mService != null) { return mService.factoryReset(); if (mService != null && mService.factoryReset() && mManagerService != null && mManagerService.onFactoryReset()) { return true; } Log.e(TAG, "factoryReset(): IBluetooth Service is null"); Log.e(TAG, "factoryReset(): Setting persist.bluetooth.factoryreset to retry later"); SystemProperties.set("persist.bluetooth.factoryreset", "true"); } catch (RemoteException e) { Log.e(TAG, "", e); Loading core/java/android/net/Uri.java +34 −27 Original line number Diff line number Diff line Loading @@ -1987,17 +1987,26 @@ public abstract class Uri implements Parcelable, Comparable<Uri> { * Enum which indicates which representation of a given part we have. */ static class Representation { static final int BOTH = 0; static final int ENCODED = 1; static final int DECODED = 2; } volatile String encoded; volatile String decoded; private final int mCanonicalRepresentation; AbstractPart(String encoded, String decoded) { if (encoded != NOT_CACHED) { this.mCanonicalRepresentation = Representation.ENCODED; this.encoded = encoded; this.decoded = NOT_CACHED; } else if (decoded != NOT_CACHED) { this.mCanonicalRepresentation = Representation.DECODED; this.encoded = NOT_CACHED; this.decoded = decoded; } else { throw new IllegalArgumentException("Neither encoded nor decoded"); } } abstract String getEncoded(); Loading @@ -2009,25 +2018,21 @@ public abstract class Uri implements Parcelable, Comparable<Uri> { } final void writeTo(Parcel parcel) { @SuppressWarnings("StringEquality") boolean hasEncoded = encoded != NOT_CACHED; @SuppressWarnings("StringEquality") boolean hasDecoded = decoded != NOT_CACHED; if (hasEncoded && hasDecoded) { parcel.writeInt(Representation.BOTH); parcel.writeString(encoded); parcel.writeString(decoded); } else if (hasEncoded) { parcel.writeInt(Representation.ENCODED); parcel.writeString(encoded); } else if (hasDecoded) { parcel.writeInt(Representation.DECODED); parcel.writeString(decoded); final String canonicalValue; if (mCanonicalRepresentation == Representation.ENCODED) { canonicalValue = encoded; } else if (mCanonicalRepresentation == Representation.DECODED) { canonicalValue = decoded; } else { throw new IllegalArgumentException("Neither encoded nor decoded"); throw new IllegalArgumentException("Unknown representation: " + mCanonicalRepresentation); } if (canonicalValue == NOT_CACHED) { throw new AssertionError("Canonical value not cached (" + mCanonicalRepresentation + ")"); } parcel.writeInt(mCanonicalRepresentation); parcel.writeString(canonicalValue); } } Loading Loading @@ -2059,13 +2064,12 @@ public abstract class Uri implements Parcelable, Comparable<Uri> { static Part readFrom(Parcel parcel) { int representation = parcel.readInt(); String value = parcel.readString(); switch (representation) { case Representation.BOTH: return from(parcel.readString(), parcel.readString()); case Representation.ENCODED: return fromEncoded(parcel.readString()); return fromEncoded(value); case Representation.DECODED: return fromDecoded(parcel.readString()); return fromDecoded(value); default: throw new IllegalArgumentException("Unknown representation: " + representation); Loading Loading @@ -2127,6 +2131,11 @@ public abstract class Uri implements Parcelable, Comparable<Uri> { private static class EmptyPart extends Part { public EmptyPart(String value) { super(value, value); if (value != null && !value.isEmpty()) { throw new IllegalArgumentException("Expected empty value, got: " + value); } // Avoid having to re-calculate the non-canonical value. encoded = decoded = value; } @Override Loading Loading @@ -2245,14 +2254,12 @@ public abstract class Uri implements Parcelable, Comparable<Uri> { static PathPart readFrom(Parcel parcel) { int representation = parcel.readInt(); switch (representation) { case Representation.BOTH: return from(parcel.readString(), parcel.readString()); case Representation.ENCODED: return fromEncoded(parcel.readString()); case Representation.DECODED: return fromDecoded(parcel.readString()); default: throw new IllegalArgumentException("Bad representation: " + representation); throw new IllegalArgumentException("Unknown representation: " + representation); } } Loading core/java/android/telephony/PhoneStateListener.java +11 −0 Original line number Diff line number Diff line Loading @@ -64,6 +64,17 @@ public class PhoneStateListener { private static final String LOG_TAG = "PhoneStateListener"; private static final boolean DBG = false; // STOPSHIP if true /** * Limit on registrations of {@link PhoneStateListener}s on a per-pid * basis. When this limit is exceeded, any calls to {@link TelephonyManager#listen} will fail * with an {@link IllegalStateException}. * * {@link android.os.Process#PHONE_UID}, {@link android.os.Process#SYSTEM_UID}, and the uid that * TelephonyRegistry runs under are exempt from this limit. * @hide */ public static final int PER_PID_REGISTRATION_LIMIT = 50; /** * Stop listening for updates. * Loading core/java/android/view/ViewConfiguration.java +2 −1 Original line number Diff line number Diff line Loading @@ -64,8 +64,9 @@ public class ViewConfiguration { /** * Defines the default duration in milliseconds before a press turns into * a long press * @hide */ private static final int DEFAULT_LONG_PRESS_TIMEOUT = 500; public static final int DEFAULT_LONG_PRESS_TIMEOUT = 400; /** * Defines the default duration in milliseconds between the first tap's up event and the second Loading Loading
cmds/screencap/screencap.cpp +33 −5 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ #include <linux/fb.h> #include <sys/ioctl.h> #include <sys/mman.h> #include <sys/wait.h> #include <binder/ProcessState.h> Loading Loading @@ -99,11 +100,38 @@ static uint32_t dataSpaceToInt(ui::Dataspace d) } static status_t notifyMediaScanner(const char* fileName) { String8 cmd("am broadcast -a android.intent.action.MEDIA_SCANNER_SCAN_FILE -d file://"); cmd.append(fileName); cmd.append(" > /dev/null"); int result = system(cmd.string()); if (result < 0) { std::string filePath("file://"); filePath.append(fileName); char *cmd[] = { (char*) "am", (char*) "broadcast", (char*) "am", (char*) "android.intent.action.MEDIA_SCANNER_SCAN_FILE", (char*) "-d", &filePath[0], nullptr }; int status; int pid = fork(); if (pid < 0){ fprintf(stderr, "Unable to fork in order to send intent for media scanner.\n"); return UNKNOWN_ERROR; } if (pid == 0){ int fd = open("/dev/null", O_WRONLY); if (fd < 0){ fprintf(stderr, "Unable to open /dev/null for media scanner stdout redirection.\n"); exit(1); } dup2(fd, 1); int result = execvp(cmd[0], cmd); close(fd); exit(result); } wait(&status); if (status < 0) { fprintf(stderr, "Unable to broadcast intent for media scanner.\n"); return UNKNOWN_ERROR; } Loading
core/java/android/bluetooth/BluetoothAdapter.java +4 −3 Original line number Diff line number Diff line Loading @@ -1196,10 +1196,11 @@ public final class BluetoothAdapter { public boolean factoryReset() { try { mServiceLock.readLock().lock(); if (mService != null) { return mService.factoryReset(); if (mService != null && mService.factoryReset() && mManagerService != null && mManagerService.onFactoryReset()) { return true; } Log.e(TAG, "factoryReset(): IBluetooth Service is null"); Log.e(TAG, "factoryReset(): Setting persist.bluetooth.factoryreset to retry later"); SystemProperties.set("persist.bluetooth.factoryreset", "true"); } catch (RemoteException e) { Log.e(TAG, "", e); Loading
core/java/android/net/Uri.java +34 −27 Original line number Diff line number Diff line Loading @@ -1987,17 +1987,26 @@ public abstract class Uri implements Parcelable, Comparable<Uri> { * Enum which indicates which representation of a given part we have. */ static class Representation { static final int BOTH = 0; static final int ENCODED = 1; static final int DECODED = 2; } volatile String encoded; volatile String decoded; private final int mCanonicalRepresentation; AbstractPart(String encoded, String decoded) { if (encoded != NOT_CACHED) { this.mCanonicalRepresentation = Representation.ENCODED; this.encoded = encoded; this.decoded = NOT_CACHED; } else if (decoded != NOT_CACHED) { this.mCanonicalRepresentation = Representation.DECODED; this.encoded = NOT_CACHED; this.decoded = decoded; } else { throw new IllegalArgumentException("Neither encoded nor decoded"); } } abstract String getEncoded(); Loading @@ -2009,25 +2018,21 @@ public abstract class Uri implements Parcelable, Comparable<Uri> { } final void writeTo(Parcel parcel) { @SuppressWarnings("StringEquality") boolean hasEncoded = encoded != NOT_CACHED; @SuppressWarnings("StringEquality") boolean hasDecoded = decoded != NOT_CACHED; if (hasEncoded && hasDecoded) { parcel.writeInt(Representation.BOTH); parcel.writeString(encoded); parcel.writeString(decoded); } else if (hasEncoded) { parcel.writeInt(Representation.ENCODED); parcel.writeString(encoded); } else if (hasDecoded) { parcel.writeInt(Representation.DECODED); parcel.writeString(decoded); final String canonicalValue; if (mCanonicalRepresentation == Representation.ENCODED) { canonicalValue = encoded; } else if (mCanonicalRepresentation == Representation.DECODED) { canonicalValue = decoded; } else { throw new IllegalArgumentException("Neither encoded nor decoded"); throw new IllegalArgumentException("Unknown representation: " + mCanonicalRepresentation); } if (canonicalValue == NOT_CACHED) { throw new AssertionError("Canonical value not cached (" + mCanonicalRepresentation + ")"); } parcel.writeInt(mCanonicalRepresentation); parcel.writeString(canonicalValue); } } Loading Loading @@ -2059,13 +2064,12 @@ public abstract class Uri implements Parcelable, Comparable<Uri> { static Part readFrom(Parcel parcel) { int representation = parcel.readInt(); String value = parcel.readString(); switch (representation) { case Representation.BOTH: return from(parcel.readString(), parcel.readString()); case Representation.ENCODED: return fromEncoded(parcel.readString()); return fromEncoded(value); case Representation.DECODED: return fromDecoded(parcel.readString()); return fromDecoded(value); default: throw new IllegalArgumentException("Unknown representation: " + representation); Loading Loading @@ -2127,6 +2131,11 @@ public abstract class Uri implements Parcelable, Comparable<Uri> { private static class EmptyPart extends Part { public EmptyPart(String value) { super(value, value); if (value != null && !value.isEmpty()) { throw new IllegalArgumentException("Expected empty value, got: " + value); } // Avoid having to re-calculate the non-canonical value. encoded = decoded = value; } @Override Loading Loading @@ -2245,14 +2254,12 @@ public abstract class Uri implements Parcelable, Comparable<Uri> { static PathPart readFrom(Parcel parcel) { int representation = parcel.readInt(); switch (representation) { case Representation.BOTH: return from(parcel.readString(), parcel.readString()); case Representation.ENCODED: return fromEncoded(parcel.readString()); case Representation.DECODED: return fromDecoded(parcel.readString()); default: throw new IllegalArgumentException("Bad representation: " + representation); throw new IllegalArgumentException("Unknown representation: " + representation); } } Loading
core/java/android/telephony/PhoneStateListener.java +11 −0 Original line number Diff line number Diff line Loading @@ -64,6 +64,17 @@ public class PhoneStateListener { private static final String LOG_TAG = "PhoneStateListener"; private static final boolean DBG = false; // STOPSHIP if true /** * Limit on registrations of {@link PhoneStateListener}s on a per-pid * basis. When this limit is exceeded, any calls to {@link TelephonyManager#listen} will fail * with an {@link IllegalStateException}. * * {@link android.os.Process#PHONE_UID}, {@link android.os.Process#SYSTEM_UID}, and the uid that * TelephonyRegistry runs under are exempt from this limit. * @hide */ public static final int PER_PID_REGISTRATION_LIMIT = 50; /** * Stop listening for updates. * Loading
core/java/android/view/ViewConfiguration.java +2 −1 Original line number Diff line number Diff line Loading @@ -64,8 +64,9 @@ public class ViewConfiguration { /** * Defines the default duration in milliseconds before a press turns into * a long press * @hide */ private static final int DEFAULT_LONG_PRESS_TIMEOUT = 500; public static final int DEFAULT_LONG_PRESS_TIMEOUT = 400; /** * Defines the default duration in milliseconds between the first tap's up event and the second Loading