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

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

Merge changes...

Merge changes Id747dc81,I3a74bd36,I2395527c,I86aeb066,Ic33d5766,I7bef7390,I4b797dd8,Id3622e9e,I28087c63,Ia1c6d909,I95a766dd,I6c0236c5,Ib71287f4,I4bcbefdc,I22a7cb8d,Ie24dbeaf,I7dbc4b45,I21d524ea,Iaa5bf14e,I7db766c3,I93fcaca2,I1eb72044,I05ffbe7c,Ifdfe2ff8,Ia8f767a2

* changes:
  Fix problems dispatching media button events on headless devices
  Add headless mode for running the framework without the surface flinger
  SettingsProvider: Allow overridding default value for Setttings.Secure.DEVICE_PROVISIONED
  Load lockscreen.disabled setting on database create as well as upgrade
  SystemUI: Log an error instead of throwing an exception if navigation bar is enabled in tablet UI
  SettingsProvider: Add support for overriding lockscreen.disabled default value
  Allow overriding default STAY_ON_WHILE_PLUGGED_IN setting value in an overlay
  Disable output processing when opening serial port.
  Update aidl for new Broker API.
  aidl: All flattenable types now must also be parcelable.
  Update aidl to new APIs.
  Suport RpcData as a parcelable type.
  Modified AIDL to support authentication
  Fix disconnect from wired ethernet issues.
  Fix PresenterClass by adding a _listener field
  add presenters to aidl.
  Add SerialPort.sendBreak()
  Generate fallthrough for unhandled actions in RPC methods.
  PhoneWindowManager: Disable boot progress dialog on headless builds
  Support custom flattenable types for RPC.
  SystemServer: Don't start A2DP service if audio is not enabled
  Add RpcData as a built-in marshallable type.
  Add the full suite of RpcData types.
  Checkpoint adding @home RPC support to aidl
  ActivityManager: Make sure BOOT_COMPLETED Intent is sent when running headless
parents adf7c11e d747dc81
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -113,10 +113,18 @@ public class SerialPort {
        }
    }

    /**
     * Sends a stream of zero valued bits for 0.25 to 0.5 seconds
     */
    public void sendBreak() {
        native_send_break();
    }

    private native void native_open(FileDescriptor pfd, int speed) throws IOException;
    private native void native_close();
    private native int native_read_array(byte[] buffer, int length) throws IOException;
    private native int native_read_direct(ByteBuffer buffer, int length) throws IOException;
    private native void native_write_array(byte[] buffer, int length) throws IOException;
    private native void native_write_direct(ByteBuffer buffer, int length) throws IOException;
    private native void native_send_break();
}
+17 −9
Original line number Diff line number Diff line
@@ -79,10 +79,7 @@ public class EthernetDataTracker implements NetworkStateTracker {
                if (up) {
                    mTracker.reconnect();
                } else {
                    NetworkUtils.stopDhcp(mIface);
                    mTracker.mNetworkInfo.setIsAvailable(false);
                    mTracker.mNetworkInfo.setDetailedState(DetailedState.DISCONNECTED,
                                                           null, null);
                    mTracker.disconnect();
                }
            }
        }
@@ -129,11 +126,7 @@ public class EthernetDataTracker implements NetworkStateTracker {
        runDhcp();
    }

    private void interfaceRemoved(String iface) {
        if (!iface.equals(mIface))
            return;

        Log.d(TAG, "Removing " + iface);
    public void disconnect() {

        NetworkUtils.stopDhcp(mIface);

@@ -147,6 +140,21 @@ public class EthernetDataTracker implements NetworkStateTracker {
        msg = mCsHandler.obtainMessage(EVENT_STATE_CHANGED, mNetworkInfo);
        msg.sendToTarget();

        IBinder b = ServiceManager.getService(Context.NETWORKMANAGEMENT_SERVICE);
        INetworkManagementService service = INetworkManagementService.Stub.asInterface(b);
        try {
            service.clearInterfaceAddresses(mIface);
        } catch (Exception e) {
            Log.e(TAG, "Failed to clear addresses or disable ipv6" + e);
        }
    }

    private void interfaceRemoved(String iface) {
        if (!iface.equals(mIface))
            return;

        Log.d(TAG, "Removing " + iface);
	disconnect();
        mIface = "";
    }

+6 −0
Original line number Diff line number Diff line
@@ -1835,6 +1835,12 @@ public final class Settings {
         */
        public static final String LOCKSCREEN_SOUNDS_ENABLED = "lockscreen_sounds_enabled";

        /**
         * Whether the lockscreen should be completely disabled.
         * @hide
         */
        public static final String LOCKSCREEN_DISABLED = "lockscreen.disabled";

        /**
         * URI for the low battery sound file.
         * @hide
+10 −0
Original line number Diff line number Diff line
@@ -146,6 +146,8 @@ android_hardware_SerialPort_open(JNIEnv *env, jobject thiz, jobject fileDescript
        memset(&tio, 0, sizeof(tio));

    tio.c_cflag =  speed | CS8 | CLOCAL | CREAD;
    // Disable output processing, including messing with end-of-line characters.
    tio.c_oflag &= ~OPOST;
    tio.c_iflag = IGNPAR;
    tio.c_lflag = 0; /* turn of CANON, ECHO*, etc */
    /* no timeout but request at least one character per read */
@@ -234,6 +236,13 @@ android_hardware_SerialPort_write_direct(JNIEnv *env, jobject thiz, jobject buff
        jniThrowException(env, "java/io/IOException", NULL);
}

static void
android_hardware_SerialPort_send_break(JNIEnv *env, jobject thiz)
{
    int fd = env->GetIntField(thiz, field_context);
    tcsendbreak(fd, 0);
}

static JNINativeMethod method_table[] = {
    {"native_open",             "(Ljava/io/FileDescriptor;I)V",
                                        (void *)android_hardware_SerialPort_open},
@@ -246,6 +255,7 @@ static JNINativeMethod method_table[] = {
                                        (void *)android_hardware_SerialPort_write_array},
    {"native_write_direct",     "(Ljava/nio/ByteBuffer;I)V",
                                        (void *)android_hardware_SerialPort_write_direct},
    {"native_send_break",       "()V",  (void *)android_hardware_SerialPort_send_break},
};

int register_android_hardware_SerialPort(JNIEnv *env)
+25 −4
Original line number Diff line number Diff line
@@ -28,6 +28,7 @@
#include <android_runtime/AndroidRuntime.h>
#include <utils/misc.h>
#include <utils/Log.h>
#include <cutils/properties.h>

// ----------------------------------------------------------------------------

@@ -44,6 +45,7 @@ struct offsets_t {
    jfieldID ydpi;
};
static offsets_t offsets;
static bool headless = false;

// ----------------------------------------------------------------------------

@@ -51,11 +53,20 @@ static void android_view_Display_init(
        JNIEnv* env, jobject clazz, jint dpy)
{
    DisplayInfo info;
    if (headless) {
        // initialize dummy display with reasonable values
        info.pixelFormatInfo.format = 1; // RGB_8888
        info.fps = 60;
        info.density = 160;
        info.xdpi = 160;
        info.ydpi = 160;
    } else {
        status_t err = SurfaceComposerClient::getDisplayInfo(DisplayID(dpy), &info);
        if (err < 0) {
            jniThrowException(env, "java/lang/IllegalArgumentException", NULL);
            return;
        }
    }
    env->SetIntField(clazz, offsets.pixelFormat,info.pixelFormatInfo.format);
    env->SetFloatField(clazz, offsets.fps,      info.fps);
    env->SetFloatField(clazz, offsets.density,  info.density);
@@ -66,6 +77,7 @@ static void android_view_Display_init(
static jint android_view_Display_getRawWidthNative(
        JNIEnv* env, jobject clazz)
{
    if (headless) return 640;
    DisplayID dpy = env->GetIntField(clazz, offsets.display);
    return SurfaceComposerClient::getDisplayWidth(dpy);
}
@@ -73,6 +85,7 @@ static jint android_view_Display_getRawWidthNative(
static jint android_view_Display_getRawHeightNative(
        JNIEnv* env, jobject clazz)
{
    if (headless) return 480;
    DisplayID dpy = env->GetIntField(clazz, offsets.display);
    return SurfaceComposerClient::getDisplayHeight(dpy);
}
@@ -80,6 +93,7 @@ static jint android_view_Display_getRawHeightNative(
static jint android_view_Display_getOrientation(
        JNIEnv* env, jobject clazz)
{
    if (headless) return 0; // Surface.ROTATION_0
    DisplayID dpy = env->GetIntField(clazz, offsets.display);
    return SurfaceComposerClient::getDisplayOrientation(dpy);
}
@@ -87,6 +101,7 @@ static jint android_view_Display_getOrientation(
static jint android_view_Display_getDisplayCount(
        JNIEnv* env, jclass clazz)
{
    if (headless) return 1;
    return SurfaceComposerClient::getNumberOfDisplays();
}

@@ -113,6 +128,12 @@ static JNINativeMethod gMethods[] = {

void nativeClassInit(JNIEnv* env, jclass clazz)
{
    char value[PROPERTY_VALUE_MAX];

    property_get("ro.config.headless", value, "0");
    if (strcmp(value, "1") == 0)
        headless = true;

    offsets.display     = env->GetFieldID(clazz, "mDisplay", "I");
    offsets.pixelFormat = env->GetFieldID(clazz, "mPixelFormat", "I");
    offsets.fps         = env->GetFieldID(clazz, "mRefreshRate", "F");
Loading