Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ced11a5b authored by Mike Lockwood's avatar Mike Lockwood Committed by Android (Google) Code Review
Browse files

Merge changes I35a76a27,I04bb7ad4,If38a1a10,Ice5be6e5,I009e443f,I968ddf90,I69d4e518,I09b1dfc9

* changes:
  Merge commit '74803dc5'
  add config_bluetooth_default_profiles config var and use it to disable bt profiles
  Do not allow Surface creation on machines without SurfaceFlinger We will fail later anyways, but this change makes it much easier to track down places where we are inadvertently doing operations that depend on the flinger.
  fix setting only usb mode
  Detect (at runtime) kernel support for the "hdmi_audio" switch.
  Add a config resource to disable key-chord screenshotting
  Do not assume that there is always a running activity (Necessary for headless devices)
  Add batch volume adjust support to adjustMasterVolume() in AudioManager and AudioService.
parents 1c8e0a07 1b6989cd
Loading
Loading
Loading
Loading
+17 −11
Original line number Diff line number Diff line
@@ -46,6 +46,7 @@ import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.SharedPreferences;
import android.content.res.Resources;
import android.os.Binder;
import android.os.Handler;
import android.os.IBinder;
@@ -554,12 +555,15 @@ public class BluetoothService extends IBluetooth.Stub {
    private synchronized void updateSdpRecords() {
        ArrayList<ParcelUuid> uuids = new ArrayList<ParcelUuid>();

        Resources R = mContext.getResources();

        // Add the default records
        if (R.getBoolean(com.android.internal.R.bool.config_bluetooth_default_profiles)) {
            uuids.add(BluetoothUuid.HSP_AG);
            uuids.add(BluetoothUuid.ObexObjectPush);
        }

        if (mContext.getResources().
                getBoolean(com.android.internal.R.bool.config_voice_capable)) {
        if (R.getBoolean(com.android.internal.R.bool.config_voice_capable)) {
            uuids.add(BluetoothUuid.Handsfree_AG);
            uuids.add(BluetoothUuid.PBAP_PSE);
        }
@@ -567,6 +571,7 @@ public class BluetoothService extends IBluetooth.Stub {
        // Add SDP records for profiles maintained by Android userspace
        addReservedSdpRecords(uuids);

        if (R.getBoolean(com.android.internal.R.bool.config_bluetooth_default_profiles)) {
            // Enable profiles maintained by Bluez userspace.
            setBluetoothTetheringNative(true, BluetoothPanProfileHandler.NAP_ROLE,
                   BluetoothPanProfileHandler.NAP_BRIDGE);
@@ -575,6 +580,7 @@ public class BluetoothService extends IBluetooth.Stub {
            uuids.add(BluetoothUuid.AudioSource);
            uuids.add(BluetoothUuid.AvrcpTarget);
            uuids.add(BluetoothUuid.NAP);
        }

        // Cannot cast uuids.toArray directly since ParcelUuid is parcelable
        mAdapterUuids = new ParcelUuid[uuids.size()];
+18 −0
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ import android.content.res.CompatibilityInfo.Translator;
import android.graphics.*;
import android.os.Parcelable;
import android.os.Parcel;
import android.os.SystemProperties;
import android.util.Log;

/**
@@ -35,6 +36,15 @@ public class Surface implements Parcelable {
    public static final int ROTATION_180     = 2;
    public static final int ROTATION_270     = 3;

    private static final boolean headless = "1".equals(
        SystemProperties.get("ro.config.headless", "0"));

    private static void checkHeadless() {
        if(headless) {
            throw new UnsupportedOperationException("Device is headless");
        }
    }

    /**
     * Create Surface from a {@link SurfaceTexture}.
     *
@@ -46,6 +56,8 @@ public class Surface implements Parcelable {
     * Surface.
     */
    public Surface(SurfaceTexture surfaceTexture) {
        checkHeadless();

        if (DEBUG_RELEASE) {
            mCreationStack = new Exception();
        }
@@ -244,6 +256,8 @@ public class Surface implements Parcelable {
    public Surface(SurfaceSession s,
            int pid, int display, int w, int h, int format, int flags)
        throws OutOfResourcesException {
        checkHeadless();

        if (DEBUG_RELEASE) {
            mCreationStack = new Exception();
        }
@@ -255,6 +269,8 @@ public class Surface implements Parcelable {
    public Surface(SurfaceSession s,
            int pid, String name, int display, int w, int h, int format, int flags)
        throws OutOfResourcesException {
        checkHeadless();

        if (DEBUG_RELEASE) {
            mCreationStack = new Exception();
        }
@@ -269,6 +285,8 @@ public class Surface implements Parcelable {
     * @hide
     */
    public Surface() {
        checkHeadless();

        if (DEBUG_RELEASE) {
            mCreationStack = new Exception();
        }
+7 −0
Original line number Diff line number Diff line
@@ -308,6 +308,9 @@
    <!-- If this is true, the screen will fade off. -->
    <bool name="config_animateScreenLights">true</bool>

    <!-- If this is true, key chords can be used to take a screenshot on the device. -->
    <bool name="config_enableScreenshotChord">true</bool>

    <!-- If true, the screen can be rotated via the accelerometer in all 4
         rotations as the default behavior. -->
    <bool name="config_allowAllRotations">false</bool>
@@ -632,6 +635,10 @@
               cell broadcasting sms, and MMS. -->
    <bool name="config_sms_capable">true</bool>

    <!-- Enable/disable default bluetooth profiles:
        HSP_AG, ObexObjectPush, Audio, NAP -->
    <bool name="config_bluetooth_default_profiles">true</bool>

    <!-- IP address of the dns server to use if nobody else suggests one -->
    <string name="config_default_dns_server" translatable="false">8.8.8.8</string>

+2 −0
Original line number Diff line number Diff line
@@ -244,6 +244,8 @@
  <java-symbol type="bool" name="config_useMasterVolume" />
  <java-symbol type="bool" name="config_enableWallpaperService" />
  <java-symbol type="bool" name="config_sendAudioBecomingNoisy" />
  <java-symbol type="bool" name="config_enableScreenshotChord" />
  <java-symbol type="bool" name="config_bluetooth_default_profiles" />

  <java-symbol type="integer" name="config_cursorWindowSize" />
  <java-symbol type="integer" name="config_longPressOnPowerBehavior" />
+4 −5
Original line number Diff line number Diff line
@@ -608,16 +608,15 @@ public class AudioManager {
     * Adjusts the master volume for the device's audio amplifier.
     * <p>
     *
     * @param direction The direction to adjust the volume. One of
     *            {@link #ADJUST_LOWER}, {@link #ADJUST_RAISE}, or
     *            {@link #ADJUST_SAME}.
     * @param steps The number of volume steps to adjust. A positive
     *            value will raise the volume.
     * @param flags One or more flags.
     * @hide
     */
    public void adjustMasterVolume(int direction, int flags) {
    public void adjustMasterVolume(int steps, int flags) {
        IAudioService service = getService();
        try {
            service.adjustMasterVolume(direction, flags);
            service.adjustMasterVolume(steps, flags);
        } catch (RemoteException e) {
            Log.e(TAG, "Dead object in adjustMasterVolume", e);
        }
Loading