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

Commit 7017e483 authored by Jeff Brown's avatar Jeff Brown Committed by Android (Google) Code Review
Browse files

Merge "Add support for Wifi display." into jb-mr1-dev

parents cd620591 cbad976b
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -259,7 +259,7 @@ public class Surface implements Parcelable {
    private static native IBinder nativeGetBuiltInDisplay(int physicalDisplayId);
    private static native IBinder nativeCreateDisplay(String name);
    private static native void nativeSetDisplaySurface(
            IBinder displayToken, SurfaceTexture surfaceTexture);
            IBinder displayToken, Surface surface);
    private static native void nativeSetDisplayLayerStack(
            IBinder displayToken, int layerStack);
    private static native void nativeSetDisplayProjection(
@@ -597,11 +597,11 @@ public class Surface implements Parcelable {
    }

    /** @hide */
    public static void setDisplaySurface(IBinder displayToken, SurfaceTexture surfaceTexture) {
    public static void setDisplaySurface(IBinder displayToken, Surface surface) {
        if (displayToken == null) {
            throw new IllegalArgumentException("displayToken must not be null");
        }
        nativeSetDisplaySurface(displayToken, surfaceTexture);
        nativeSetDisplaySurface(displayToken, surface);
    }

    /** @hide */
+57 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2012 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.android.internal.util;

import android.os.Handler;

import java.io.PrintWriter;
import java.io.StringWriter;

/**
 * Helper functions for dumping the state of system services.
 */
public final class DumpUtils {
    private DumpUtils() {
    }

    /**
     * Helper for dumping state owned by a handler thread.
     *
     * Because the caller might be holding an important lock that the handler is
     * trying to acquire, we use a short timeout to avoid deadlocks.  The process
     * is inelegant but this function is only used for debugging purposes.
     */
    public static void dumpAsync(Handler handler, final Dump dump, PrintWriter pw, long timeout) {
        final StringWriter sw = new StringWriter();
        if (handler.runWithScissors(new Runnable() {
            @Override
            public void run() {
                PrintWriter lpw = new PrintWriter(sw);
                dump.dump(lpw);
                lpw.close();
            }
        }, timeout)) {
            pw.print(sw.toString());
        } else {
            pw.println("... timed out");
        }
    }

    public interface Dump {
        void dump(PrintWriter pw);
    }
}
+28 −10
Original line number Diff line number Diff line
@@ -28,7 +28,7 @@ public class IndentingPrintWriter extends PrintWriter {
    private final String mIndent;

    private StringBuilder mBuilder = new StringBuilder();
    private String mCurrent = new String();
    private char[] mCurrent;
    private boolean mEmptyLine = true;

    public IndentingPrintWriter(Writer writer, String indent) {
@@ -38,12 +38,12 @@ public class IndentingPrintWriter extends PrintWriter {

    public void increaseIndent() {
        mBuilder.append(mIndent);
        mCurrent = mBuilder.toString();
        mCurrent = null;
    }

    public void decreaseIndent() {
        mBuilder.delete(0, mIndent.length());
        mCurrent = mBuilder.toString();
        mCurrent = null;
    }

    public void printPair(String key, Object value) {
@@ -51,17 +51,35 @@ public class IndentingPrintWriter extends PrintWriter {
    }

    @Override
    public void println() {
        super.println();
    public void write(char[] buf, int offset, int count) {
        final int bufferEnd = offset + count;
        int lineStart = offset;
        int lineEnd = offset;
        while (lineEnd < bufferEnd) {
            char ch = buf[lineEnd++];
            if (ch == '\n') {
                writeIndent();
                super.write(buf, lineStart, lineEnd - lineStart);
                lineStart = lineEnd;
                mEmptyLine = true;
            }
        }

    @Override
    public void write(char[] buf, int offset, int count) {
        if (lineStart != lineEnd) {
            writeIndent();
            super.write(buf, lineStart, lineEnd - lineStart);
        }
    }

    private void writeIndent() {
        if (mEmptyLine) {
            mEmptyLine = false;
            super.print(mCurrent);
            if (mBuilder.length() != 0) {
                if (mCurrent == null) {
                    mCurrent = mBuilder.toString().toCharArray();
                }
                super.write(mCurrent, 0, mCurrent.length);
            }
        }
        super.write(buf, offset, count);
    }
}
+1 −0
Original line number Diff line number Diff line
@@ -126,6 +126,7 @@ LOCAL_SRC_FILES:= \
	android_media_AudioSystem.cpp \
	android_media_AudioTrack.cpp \
	android_media_JetPlayer.cpp \
	android_media_RemoteDisplay.cpp \
	android_media_ToneGenerator.cpp \
	android_hardware_Camera.cpp \
	android_hardware_SensorManager.cpp \
+2 −0
Original line number Diff line number Diff line
@@ -160,6 +160,7 @@ extern int register_android_backup_BackupHelperDispatcher(JNIEnv *env);
extern int register_android_app_backup_FullBackup(JNIEnv *env);
extern int register_android_app_ActivityThread(JNIEnv *env);
extern int register_android_app_NativeActivity(JNIEnv *env);
extern int register_android_media_RemoteDisplay(JNIEnv *env);
extern int register_android_view_InputChannel(JNIEnv* env);
extern int register_android_view_InputDevice(JNIEnv* env);
extern int register_android_view_InputEventReceiver(JNIEnv* env);
@@ -1161,6 +1162,7 @@ static const RegJNIRec gRegJNI[] = {
    REG_JNI(register_android_media_AudioSystem),
    REG_JNI(register_android_media_AudioTrack),
    REG_JNI(register_android_media_JetPlayer),
    REG_JNI(register_android_media_RemoteDisplay),
    REG_JNI(register_android_media_ToneGenerator),

    REG_JNI(register_android_opengl_classes),
Loading