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

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

Merge changes...

Merge changes Iefeba018,I1ce5b26d,Ie3f59793,Id3c5e1ec,I9063154a,Ib7bd88a3,I20963df8,I01060b08,I7dc29739,I5c55a051,Ia07aa3c4,I3194ea94,I0dc37cce,Ic3a7bb65,I0a7eaecf,Ifa7b0614,Ice952c8e,Ia5abdb9e,Ifcb310f9,If5f4ec97,I4767690f,I79824179,I6e0f981e,Id60ae7f6

* changes:
  EthernetDataTracker: Don't run DHCP or set network available until link is up
  Only send master volume or mute updates if the settings have changed
  Make AudioManager.adjustMasterVolume public and hidden
  Allow disabling network stats support in a resource overlay
  Restore persisted master volume if the media server restarts
  Don't allow changing master volume when muted
  Show the flags in package manager debugging.
  Modified the constructor of EndpointBase
  Add a getEndpointInfo accessor to AIDL-generated RPC proxy classes
  Defer persisting master data to avoid excessive database writes
  Add an option that disables the AUDIO_BECOMING_NOISY intent send when a headset is hotplugged.
  Remove reference counting and client death notification for master mute
  AudioService: Send broadcasts when master volume and mute state change
  Use the new get/putFlattenable methods on RpcData.
  Don't try to unmarshal void return types when there are out parameters being returned.
  AudioManager: Add wrapper methods for master volume support
  AudioManager: Add support for master mute
  NetworkTimeUpdateService: Schedule NTP on ethernet connect as well as wifi
  For events, require that the parameters be marked in.
  PhoneWindowManager: stifle warning that ITelephony service does not exist
  AudioManager: transparently convert volume settings for other streams to master volume if config_useMasterVolume is set.
  Support putting Flattenables in Lists.
  Was generating code that uses the wrong RpcData.
  store the hw addr in the extraInfo field of ethernet NetworkInfos
parents 0ee0969f efeba018
Loading
Loading
Loading
Loading
+18 −13
Original line number Original line Diff line number Diff line
@@ -49,6 +49,7 @@ public class EthernetDataTracker implements NetworkStateTracker {
    private LinkCapabilities mLinkCapabilities;
    private LinkCapabilities mLinkCapabilities;
    private NetworkInfo mNetworkInfo;
    private NetworkInfo mNetworkInfo;
    private InterfaceObserver mInterfaceObserver;
    private InterfaceObserver mInterfaceObserver;
    private String mHwAddr;


    /* For sending events to connectivity service handler */
    /* For sending events to connectivity service handler */
    private Handler mCsHandler;
    private Handler mCsHandler;
@@ -74,6 +75,7 @@ public class EthernetDataTracker implements NetworkStateTracker {
            if (mIface.equals(iface) && mLinkUp != up) {
            if (mIface.equals(iface) && mLinkUp != up) {
                Log.d(TAG, "Interface " + iface + " link " + (up ? "up" : "down"));
                Log.d(TAG, "Interface " + iface + " link " + (up ? "up" : "down"));
                mLinkUp = up;
                mLinkUp = up;
                mTracker.mNetworkInfo.setIsAvailable(up);


                // use DHCP
                // use DHCP
                if (up) {
                if (up) {
@@ -101,10 +103,6 @@ public class EthernetDataTracker implements NetworkStateTracker {
        mNetworkInfo = new NetworkInfo(ConnectivityManager.TYPE_ETHERNET, 0, NETWORKTYPE, "");
        mNetworkInfo = new NetworkInfo(ConnectivityManager.TYPE_ETHERNET, 0, NETWORKTYPE, "");
        mLinkProperties = new LinkProperties();
        mLinkProperties = new LinkProperties();
        mLinkCapabilities = new LinkCapabilities();
        mLinkCapabilities = new LinkCapabilities();
        mLinkUp = false;

        mNetworkInfo.setIsAvailable(false);
        setTeardownRequested(false);
    }
    }


    private void interfaceAdded(String iface) {
    private void interfaceAdded(String iface) {
@@ -113,7 +111,7 @@ public class EthernetDataTracker implements NetworkStateTracker {


        Log.d(TAG, "Adding " + iface);
        Log.d(TAG, "Adding " + iface);


        synchronized(mIface) {
        synchronized(this) {
            if(!mIface.isEmpty())
            if(!mIface.isEmpty())
                return;
                return;
            mIface = iface;
            mIface = iface;
@@ -122,8 +120,6 @@ public class EthernetDataTracker implements NetworkStateTracker {
        mNetworkInfo.setIsAvailable(true);
        mNetworkInfo.setIsAvailable(true);
        Message msg = mCsHandler.obtainMessage(EVENT_CONFIGURATION_CHANGED, mNetworkInfo);
        Message msg = mCsHandler.obtainMessage(EVENT_CONFIGURATION_CHANGED, mNetworkInfo);
        msg.sendToTarget();
        msg.sendToTarget();

        runDhcp();
    }
    }


    public void disconnect() {
    public void disconnect() {
@@ -132,7 +128,7 @@ public class EthernetDataTracker implements NetworkStateTracker {


        mLinkProperties.clear();
        mLinkProperties.clear();
        mNetworkInfo.setIsAvailable(false);
        mNetworkInfo.setIsAvailable(false);
        mNetworkInfo.setDetailedState(DetailedState.DISCONNECTED, null, null);
        mNetworkInfo.setDetailedState(DetailedState.DISCONNECTED, null, mHwAddr);


        Message msg = mCsHandler.obtainMessage(EVENT_CONFIGURATION_CHANGED, mNetworkInfo);
        Message msg = mCsHandler.obtainMessage(EVENT_CONFIGURATION_CHANGED, mNetworkInfo);
        msg.sendToTarget();
        msg.sendToTarget();
@@ -169,7 +165,7 @@ public class EthernetDataTracker implements NetworkStateTracker {
                mLinkProperties = dhcpInfoInternal.makeLinkProperties();
                mLinkProperties = dhcpInfoInternal.makeLinkProperties();
                mLinkProperties.setInterfaceName(mIface);
                mLinkProperties.setInterfaceName(mIface);


                mNetworkInfo.setDetailedState(DetailedState.CONNECTED, null, null);
                mNetworkInfo.setDetailedState(DetailedState.CONNECTED, null, mHwAddr);
                Message msg = mCsHandler.obtainMessage(EVENT_STATE_CHANGED, mNetworkInfo);
                Message msg = mCsHandler.obtainMessage(EVENT_STATE_CHANGED, mNetworkInfo);
                msg.sendToTarget();
                msg.sendToTarget();
            }
            }
@@ -216,8 +212,15 @@ public class EthernetDataTracker implements NetworkStateTracker {
            for (String iface : ifaces) {
            for (String iface : ifaces) {
                if (iface.matches(sIfaceMatch)) {
                if (iface.matches(sIfaceMatch)) {
                    mIface = iface;
                    mIface = iface;
                    service.setInterfaceUp(iface);
                    InterfaceConfiguration config = service.getInterfaceConfig(iface);
                    InterfaceConfiguration config = service.getInterfaceConfig(iface);
                    mLinkUp = config.isActive();
                    mLinkUp = config.isActive();
                    if (config != null && mHwAddr == null) {
                        mHwAddr = config.getHardwareAddress();
                        if (mHwAddr != null) {
                            mNetworkInfo.setExtraInfo(mHwAddr);
                        }
                    }
                    reconnect();
                    reconnect();
                    break;
                    break;
                }
                }
@@ -247,9 +250,11 @@ public class EthernetDataTracker implements NetworkStateTracker {
     * Re-enable connectivity to a network after a {@link #teardown()}.
     * Re-enable connectivity to a network after a {@link #teardown()}.
     */
     */
    public boolean reconnect() {
    public boolean reconnect() {
        if (mLinkUp) {
            mTeardownRequested.set(false);
            mTeardownRequested.set(false);
            runDhcp();
            runDhcp();
        return true;
        }
        return mLinkUp;
    }
    }


    /**
    /**
+12 −0
Original line number Original line Diff line number Diff line
@@ -350,6 +350,18 @@ public class NetworkInfo implements Parcelable {
        }
        }
    }
    }


    /**
     * Set the extraInfo field.
     * @param extraInfo an optional {@code String} providing addditional network state
     * information passed up from the lower networking layers.
     * @hide
     */
    public void setExtraInfo(String extraInfo) {
        synchronized (this) {
            this.mExtraInfo = extraInfo;
        }
    }

    /**
    /**
     * Report the reason an attempt to establish connectivity failed,
     * Report the reason an attempt to establish connectivity failed,
     * if one is available.
     * if one is available.
+37 −12
Original line number Original line Diff line number Diff line
@@ -91,9 +91,10 @@ public class VolumePanel extends Handler implements OnSeekBarChangeListener, Vie
    private static final int MSG_VIBRATE = 4;
    private static final int MSG_VIBRATE = 4;
    private static final int MSG_TIMEOUT = 5;
    private static final int MSG_TIMEOUT = 5;
    private static final int MSG_RINGER_MODE_CHANGED = 6;
    private static final int MSG_RINGER_MODE_CHANGED = 6;
    private static final int MSG_MUTE_CHANGED = 7;


    // Pseudo stream type for master volume
    // Pseudo stream type for master volume
    private static final int STREAM_MASTER = -1;
    private static final int STREAM_MASTER = -100;


    protected Context mContext;
    protected Context mContext;
    private AudioManager mAudioManager;
    private AudioManager mAudioManager;
@@ -295,45 +296,39 @@ public class VolumePanel extends Handler implements OnSeekBarChangeListener, Vie


    private boolean isMuted(int streamType) {
    private boolean isMuted(int streamType) {
        if (streamType == STREAM_MASTER) {
        if (streamType == STREAM_MASTER) {
            // master volume mute not yet supported
            return mAudioService.isMasterMute();
            return false;
        } else {
        } else {
            return mAudioService.isStreamMute(streamType);
            return mAudioService.isStreamMute(streamType);
        }
        }
    }
    }


    private int getStreamMaxVolume(int streamType) {
    private int getStreamMaxVolume(int streamType) {
        // master volume is 0.0f - 1.0f, but we will use 0 - 100 internally
        if (streamType == STREAM_MASTER) {
        if (streamType == STREAM_MASTER) {
            return 100;
            return mAudioService.getMasterMaxVolume();
        } else {
        } else {
            return mAudioService.getStreamMaxVolume(streamType);
            return mAudioService.getStreamMaxVolume(streamType);
        }
        }
    }
    }


    private int getStreamVolume(int streamType) {
    private int getStreamVolume(int streamType) {
         // master volume is 0.0f - 1.0f, but we will use 0 - 100 internally
        if (streamType == STREAM_MASTER) {
        if (streamType == STREAM_MASTER) {
            return Math.round(mAudioService.getMasterVolume() * 100);
            return mAudioService.getMasterVolume();
        } else {
        } else {
            return mAudioService.getStreamVolume(streamType);
            return mAudioService.getStreamVolume(streamType);
        }
        }
    }
    }


    private void setStreamVolume(int streamType, int index, int flags) {
    private void setStreamVolume(int streamType, int index, int flags) {
         // master volume is 0.0f - 1.0f, but we will use 0 - 100 internally
        if (streamType == STREAM_MASTER) {
        if (streamType == STREAM_MASTER) {
            mAudioService.setMasterVolume((float)index / 100.0f);
            mAudioService.setMasterVolume(index, flags);
        } else {
        } else {
            mAudioService.setStreamVolume(streamType, index, flags);
            mAudioService.setStreamVolume(streamType, index, flags);
        }
        }
    }
    }


    private int getLastAudibleStreamVolume(int streamType) {
    private int getLastAudibleStreamVolume(int streamType) {
         // master volume is 0.0f - 1.0f, but we will use 0 - 100 internally
        if (streamType == STREAM_MASTER) {
        if (streamType == STREAM_MASTER) {
            // master volume mute not yet supported
            return mAudioService.getLastAudibleMasterVolume();
            return getStreamVolume(STREAM_MASTER);
        } else {
        } else {
            return mAudioService.getLastAudibleStreamVolume(streamType);
            return mAudioService.getLastAudibleStreamVolume(streamType);
        }
        }
@@ -456,6 +451,19 @@ public class VolumePanel extends Handler implements OnSeekBarChangeListener, Vie
        postVolumeChanged(STREAM_MASTER, flags);
        postVolumeChanged(STREAM_MASTER, flags);
    }
    }


    public void postMuteChanged(int streamType, int flags) {
        if (hasMessages(MSG_VOLUME_CHANGED)) return;
        if (mStreamControls == null) {
            createSliders();
        }
        removeMessages(MSG_FREE_RESOURCES);
        obtainMessage(MSG_MUTE_CHANGED, streamType, flags).sendToTarget();
    }

    public void postMasterMuteChanged(int flags) {
        postMuteChanged(STREAM_MASTER, flags);
    }

    /**
    /**
     * Override this if you have other work to do when the volume changes (for
     * Override this if you have other work to do when the volume changes (for
     * example, vibrating, playing a sound, etc.). Make sure to call through to
     * example, vibrating, playing a sound, etc.). Make sure to call through to
@@ -489,6 +497,18 @@ public class VolumePanel extends Handler implements OnSeekBarChangeListener, Vie
        resetTimeout();
        resetTimeout();
    }
    }


    protected void onMuteChanged(int streamType, int flags) {

        if (LOGD) Log.d(TAG, "onMuteChanged(streamType: " + streamType + ", flags: " + flags + ")");

        StreamControl sc = mStreamControls.get(streamType);
        if (sc != null) {
            sc.icon.setImageResource(isMuted(sc.streamType) ? sc.iconMuteRes : sc.iconRes);
        }

        onVolumeChanged(streamType, flags);
    }

    protected void onShowVolumeChanged(int streamType, int flags) {
    protected void onShowVolumeChanged(int streamType, int flags) {
        int index = isMuted(streamType) ?
        int index = isMuted(streamType) ?
                getLastAudibleStreamVolume(streamType)
                getLastAudibleStreamVolume(streamType)
@@ -687,6 +707,11 @@ public class VolumePanel extends Handler implements OnSeekBarChangeListener, Vie
                break;
                break;
            }
            }


            case MSG_MUTE_CHANGED: {
                onMuteChanged(msg.arg1, msg.arg2);
                break;
            }

            case MSG_FREE_RESOURCES: {
            case MSG_FREE_RESOURCES: {
                onFreeResources();
                onFreeResources();
                break;
                break;
+4 −0
Original line number Original line Diff line number Diff line
@@ -65,6 +65,10 @@
         master volume stream and nothing else . -->
         master volume stream and nothing else . -->
    <bool name="config_useMasterVolume">false</bool>
    <bool name="config_useMasterVolume">false</bool>


    <!-- Flag indicating whether the AUDIO_BECOMING_NOISY notification should
         be sent during an change to the audio output device. -->
    <bool name="config_sendAudioBecomingNoisy">true</bool>

    <!-- The duration (in milliseconds) of a short animation. -->
    <!-- The duration (in milliseconds) of a short animation. -->
    <integer name="config_shortAnimTime">200</integer>
    <integer name="config_shortAnimTime">200</integer>


+1 −0
Original line number Original line Diff line number Diff line
@@ -236,6 +236,7 @@
  <java-symbol type="bool" name="split_action_bar_is_narrow" />
  <java-symbol type="bool" name="split_action_bar_is_narrow" />
  <java-symbol type="bool" name="config_useMasterVolume" />
  <java-symbol type="bool" name="config_useMasterVolume" />
  <java-symbol type="bool" name="config_enableWallpaperService" />
  <java-symbol type="bool" name="config_enableWallpaperService" />
  <java-symbol type="bool" name="config_sendAudioBecomingNoisy" />


  <java-symbol type="integer" name="config_cursorWindowSize" />
  <java-symbol type="integer" name="config_cursorWindowSize" />
  <java-symbol type="integer" name="config_longPressOnPowerBehavior" />
  <java-symbol type="integer" name="config_longPressOnPowerBehavior" />
Loading