Loading core/java/android/content/res/AssetFileDescriptor.java +45 −52 Original line number Diff line number Diff line Loading @@ -21,8 +21,6 @@ import android.os.Bundle; import android.os.Parcel; import android.os.ParcelFileDescriptor; import android.os.Parcelable; import android.system.ErrnoException; import android.system.Os; import java.io.Closeable; import java.io.FileDescriptor; Loading Loading @@ -205,24 +203,19 @@ public class AssetFileDescriptor implements Parcelable, Closeable { */ public static class AutoCloseInputStream extends ParcelFileDescriptor.AutoCloseInputStream { private final long mSizeFromStartOffset; private final long mStartOffset; private long mPosFromStartOffset; private long mRemaining; public AutoCloseInputStream(AssetFileDescriptor fd) throws IOException { super(fd.getParcelFileDescriptor()); // this skip is necessary if getChannel() is called super.skip(fd.getStartOffset()); mSizeFromStartOffset = fd.getLength(); mStartOffset = fd.getStartOffset(); mRemaining = (int) fd.getLength(); } @Override public int available() throws IOException { long available = mSizeFromStartOffset - mPosFromStartOffset; return available >= 0 ? (available < 0x7fffffff ? (int) available : 0x7fffffff) : 0; return mRemaining >= 0 ? (mRemaining < 0x7fffffff ? (int) mRemaining : 0x7fffffff) : super.available(); } @Override Loading @@ -234,24 +227,15 @@ public class AssetFileDescriptor implements Parcelable, Closeable { @Override public int read(byte[] buffer, int offset, int count) throws IOException { int available = available(); if (available <= 0) { return -1; } else { if (count > available) count = available; try { int res = Os.pread(getFD(), buffer, offset, count, mStartOffset + mPosFromStartOffset); // pread returns 0 at end of file, while java's InputStream interface // requires -1 if (res == 0) res = -1; if (res >= 0) mPosFromStartOffset += res; if (mRemaining >= 0) { if (mRemaining == 0) return -1; if (count > mRemaining) count = (int) mRemaining; int res = super.read(buffer, offset, count); if (res >= 0) mRemaining -= res; return res; } catch (ErrnoException e) { throw new IOException(e); } } return super.read(buffer, offset, count); } @Override Loading @@ -261,32 +245,42 @@ public class AssetFileDescriptor implements Parcelable, Closeable { @Override public long skip(long count) throws IOException { int available = available(); if (available <= 0) { return -1; } else { if (count > available) count = available; mPosFromStartOffset += count; return count; if (mRemaining >= 0) { if (mRemaining == 0) return -1; if (count > mRemaining) count = mRemaining; long res = super.skip(count); if (res >= 0) mRemaining -= res; return res; } return super.skip(count); } @Override public void mark(int readlimit) { if (mRemaining >= 0) { // Not supported. return; } super.mark(readlimit); } @Override public boolean markSupported() { if (mRemaining >= 0) { return false; } return super.markSupported(); } @Override public synchronized void reset() throws IOException { if (mRemaining >= 0) { // Not supported. return; } super.reset(); } } /** Loading Loading @@ -381,7 +375,6 @@ public class AssetFileDescriptor implements Parcelable, Closeable { public AssetFileDescriptor createFromParcel(Parcel in) { return new AssetFileDescriptor(in); } public AssetFileDescriptor[] newArray(int size) { return new AssetFileDescriptor[size]; } Loading core/java/android/hardware/Sensor.java +4 −2 Original line number Diff line number Diff line Loading @@ -712,14 +712,16 @@ public final class Sensor { public static final String STRING_TYPE_HINGE_ANGLE = "android.sensor.hinge_angle"; /** * A constant describing a head tracker sensor. * A constant describing a head tracker sensor. Note that this sensor type is typically not * available for apps to use. * * See {@link android.hardware.SensorEvent#values SensorEvent.values} for more details. */ public static final int TYPE_HEAD_TRACKER = 37; /** * A constant string describing a head tracker sensor. * A constant string describing a head tracker sensor. Note that this sensor type is typically * not available for apps to use. * * See {@link android.hardware.SensorEvent#values SensorEvent.values} for more details. */ Loading core/java/android/speech/RecognitionService.java +3 −2 Original line number Diff line number Diff line Loading @@ -129,8 +129,9 @@ public abstract class RecognitionService extends Service { @NonNull AttributionSource attributionSource) { try { if (mCurrentCallback == null) { boolean preflightPermissionCheckPassed = checkPermissionForPreflightNotHardDenied( attributionSource); boolean preflightPermissionCheckPassed = intent.hasExtra(RecognizerIntent.EXTRA_AUDIO_SOURCE) || checkPermissionForPreflightNotHardDenied(attributionSource); if (preflightPermissionCheckPassed) { if (DBG) { Log.d(TAG, "created new mCurrentCallback, listener = " Loading core/res/AndroidManifest.xml +1 −1 Original line number Diff line number Diff line Loading @@ -7044,7 +7044,7 @@ android:permission="android.permission.BIND_JOB_SERVICE"> </service> <service android:name="com.android.server.companion.AssociationCleanUpService" <service android:name="com.android.server.companion.InactiveAssociationsRemovalService" android:permission="android.permission.BIND_JOB_SERVICE"> </service> Loading packages/SettingsLib/src/com/android/settingslib/bluetooth/CachedBluetoothDevice.java +38 −1 Original line number Diff line number Diff line Loading @@ -77,6 +77,8 @@ public class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice> private final LocalBluetoothProfileManager mProfileManager; private final Object mProfileLock = new Object(); BluetoothDevice mDevice; private int mDeviceSide; private int mDeviceMode; private long mHiSyncId; private int mGroupId; // Need this since there is no method for getting RSSI Loading Loading @@ -335,6 +337,22 @@ public class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice> connectDevice(); } public int getDeviceSide() { return mDeviceSide; } public void setDeviceSide(int side) { mDeviceSide = side; } public int getDeviceMode() { return mDeviceMode; } public void setDeviceMode(int mode) { mDeviceMode = mode; } public long getHiSyncId() { return mHiSyncId; } Loading Loading @@ -1111,7 +1129,8 @@ public class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice> stringRes = R.string.bluetooth_battery_level; } // Set active string in following device connected situation. // Set active string in following device connected situation, also show battery // information if they have. // 1. Hearing Aid device active. // 2. Headset device active with in-calling state. // 3. A2DP device active without in-calling state. Loading @@ -1130,6 +1149,24 @@ public class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice> stringRes = R.string.bluetooth_active_no_battery_level; } } // Try to show left/right information if can not get it from battery for hearing // aids specifically. if (mIsActiveDeviceHearingAid && stringRes == R.string.bluetooth_active_no_battery_level) { final CachedBluetoothDevice subDevice = getSubDevice(); if (subDevice != null && subDevice.isConnected()) { stringRes = R.string.bluetooth_hearing_aid_left_and_right_active; } else { if (mDeviceSide == HearingAidProfile.DeviceSide.SIDE_LEFT) { stringRes = R.string.bluetooth_hearing_aid_left_active; } else if (mDeviceSide == HearingAidProfile.DeviceSide.SIDE_RIGHT) { stringRes = R.string.bluetooth_hearing_aid_right_active; } else { stringRes = R.string.bluetooth_active_no_battery_level; } } } } } Loading Loading
core/java/android/content/res/AssetFileDescriptor.java +45 −52 Original line number Diff line number Diff line Loading @@ -21,8 +21,6 @@ import android.os.Bundle; import android.os.Parcel; import android.os.ParcelFileDescriptor; import android.os.Parcelable; import android.system.ErrnoException; import android.system.Os; import java.io.Closeable; import java.io.FileDescriptor; Loading Loading @@ -205,24 +203,19 @@ public class AssetFileDescriptor implements Parcelable, Closeable { */ public static class AutoCloseInputStream extends ParcelFileDescriptor.AutoCloseInputStream { private final long mSizeFromStartOffset; private final long mStartOffset; private long mPosFromStartOffset; private long mRemaining; public AutoCloseInputStream(AssetFileDescriptor fd) throws IOException { super(fd.getParcelFileDescriptor()); // this skip is necessary if getChannel() is called super.skip(fd.getStartOffset()); mSizeFromStartOffset = fd.getLength(); mStartOffset = fd.getStartOffset(); mRemaining = (int) fd.getLength(); } @Override public int available() throws IOException { long available = mSizeFromStartOffset - mPosFromStartOffset; return available >= 0 ? (available < 0x7fffffff ? (int) available : 0x7fffffff) : 0; return mRemaining >= 0 ? (mRemaining < 0x7fffffff ? (int) mRemaining : 0x7fffffff) : super.available(); } @Override Loading @@ -234,24 +227,15 @@ public class AssetFileDescriptor implements Parcelable, Closeable { @Override public int read(byte[] buffer, int offset, int count) throws IOException { int available = available(); if (available <= 0) { return -1; } else { if (count > available) count = available; try { int res = Os.pread(getFD(), buffer, offset, count, mStartOffset + mPosFromStartOffset); // pread returns 0 at end of file, while java's InputStream interface // requires -1 if (res == 0) res = -1; if (res >= 0) mPosFromStartOffset += res; if (mRemaining >= 0) { if (mRemaining == 0) return -1; if (count > mRemaining) count = (int) mRemaining; int res = super.read(buffer, offset, count); if (res >= 0) mRemaining -= res; return res; } catch (ErrnoException e) { throw new IOException(e); } } return super.read(buffer, offset, count); } @Override Loading @@ -261,32 +245,42 @@ public class AssetFileDescriptor implements Parcelable, Closeable { @Override public long skip(long count) throws IOException { int available = available(); if (available <= 0) { return -1; } else { if (count > available) count = available; mPosFromStartOffset += count; return count; if (mRemaining >= 0) { if (mRemaining == 0) return -1; if (count > mRemaining) count = mRemaining; long res = super.skip(count); if (res >= 0) mRemaining -= res; return res; } return super.skip(count); } @Override public void mark(int readlimit) { if (mRemaining >= 0) { // Not supported. return; } super.mark(readlimit); } @Override public boolean markSupported() { if (mRemaining >= 0) { return false; } return super.markSupported(); } @Override public synchronized void reset() throws IOException { if (mRemaining >= 0) { // Not supported. return; } super.reset(); } } /** Loading Loading @@ -381,7 +375,6 @@ public class AssetFileDescriptor implements Parcelable, Closeable { public AssetFileDescriptor createFromParcel(Parcel in) { return new AssetFileDescriptor(in); } public AssetFileDescriptor[] newArray(int size) { return new AssetFileDescriptor[size]; } Loading
core/java/android/hardware/Sensor.java +4 −2 Original line number Diff line number Diff line Loading @@ -712,14 +712,16 @@ public final class Sensor { public static final String STRING_TYPE_HINGE_ANGLE = "android.sensor.hinge_angle"; /** * A constant describing a head tracker sensor. * A constant describing a head tracker sensor. Note that this sensor type is typically not * available for apps to use. * * See {@link android.hardware.SensorEvent#values SensorEvent.values} for more details. */ public static final int TYPE_HEAD_TRACKER = 37; /** * A constant string describing a head tracker sensor. * A constant string describing a head tracker sensor. Note that this sensor type is typically * not available for apps to use. * * See {@link android.hardware.SensorEvent#values SensorEvent.values} for more details. */ Loading
core/java/android/speech/RecognitionService.java +3 −2 Original line number Diff line number Diff line Loading @@ -129,8 +129,9 @@ public abstract class RecognitionService extends Service { @NonNull AttributionSource attributionSource) { try { if (mCurrentCallback == null) { boolean preflightPermissionCheckPassed = checkPermissionForPreflightNotHardDenied( attributionSource); boolean preflightPermissionCheckPassed = intent.hasExtra(RecognizerIntent.EXTRA_AUDIO_SOURCE) || checkPermissionForPreflightNotHardDenied(attributionSource); if (preflightPermissionCheckPassed) { if (DBG) { Log.d(TAG, "created new mCurrentCallback, listener = " Loading
core/res/AndroidManifest.xml +1 −1 Original line number Diff line number Diff line Loading @@ -7044,7 +7044,7 @@ android:permission="android.permission.BIND_JOB_SERVICE"> </service> <service android:name="com.android.server.companion.AssociationCleanUpService" <service android:name="com.android.server.companion.InactiveAssociationsRemovalService" android:permission="android.permission.BIND_JOB_SERVICE"> </service> Loading
packages/SettingsLib/src/com/android/settingslib/bluetooth/CachedBluetoothDevice.java +38 −1 Original line number Diff line number Diff line Loading @@ -77,6 +77,8 @@ public class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice> private final LocalBluetoothProfileManager mProfileManager; private final Object mProfileLock = new Object(); BluetoothDevice mDevice; private int mDeviceSide; private int mDeviceMode; private long mHiSyncId; private int mGroupId; // Need this since there is no method for getting RSSI Loading Loading @@ -335,6 +337,22 @@ public class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice> connectDevice(); } public int getDeviceSide() { return mDeviceSide; } public void setDeviceSide(int side) { mDeviceSide = side; } public int getDeviceMode() { return mDeviceMode; } public void setDeviceMode(int mode) { mDeviceMode = mode; } public long getHiSyncId() { return mHiSyncId; } Loading Loading @@ -1111,7 +1129,8 @@ public class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice> stringRes = R.string.bluetooth_battery_level; } // Set active string in following device connected situation. // Set active string in following device connected situation, also show battery // information if they have. // 1. Hearing Aid device active. // 2. Headset device active with in-calling state. // 3. A2DP device active without in-calling state. Loading @@ -1130,6 +1149,24 @@ public class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice> stringRes = R.string.bluetooth_active_no_battery_level; } } // Try to show left/right information if can not get it from battery for hearing // aids specifically. if (mIsActiveDeviceHearingAid && stringRes == R.string.bluetooth_active_no_battery_level) { final CachedBluetoothDevice subDevice = getSubDevice(); if (subDevice != null && subDevice.isConnected()) { stringRes = R.string.bluetooth_hearing_aid_left_and_right_active; } else { if (mDeviceSide == HearingAidProfile.DeviceSide.SIDE_LEFT) { stringRes = R.string.bluetooth_hearing_aid_left_active; } else if (mDeviceSide == HearingAidProfile.DeviceSide.SIDE_RIGHT) { stringRes = R.string.bluetooth_hearing_aid_right_active; } else { stringRes = R.string.bluetooth_active_no_battery_level; } } } } } Loading