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

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

Merge "Remove DozeHardware since it will not be used." into lmp-dev

parents 5bceb89c 0f208eb7
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -215,7 +215,6 @@ LOCAL_SRC_FILES += \
	core/java/android/print/IWriteResultCallback.aidl \
	core/java/android/printservice/IPrintService.aidl \
	core/java/android/printservice/IPrintServiceClient.aidl \
	core/java/android/service/dreams/IDozeHardware.aidl \
	core/java/android/service/dreams/IDreamManager.aidl \
	core/java/android/service/dreams/IDreamService.aidl \
	core/java/android/service/persistentdata/IPersistentDataBlockService.aidl \
+0 −77
Original line number Diff line number Diff line
/**
 * Copyright (C) 2014 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 android.service.dreams;

import android.os.RemoteException;
import android.util.Log;

/**
 * Provides access to low-level hardware features that a dream may use to provide
 * a richer user experience while dozing.
 * <p>
 * This class contains functions that should be called by the dream to configure
 * hardware before starting to doze and allowing the application processor to suspend.
 * For example, the dream may provide the hardware with enough information to render
 * some content on its own without any further assistance from the application processor.
 * </p><p>
 * This object is obtained by calling {@link DreamService#getDozeHardware()}.
 * </p>
 *
 * @hide experimental
 */
public final class DozeHardware {
    private static final String TAG = "DozeHardware";

    public static final String MSG_ENABLE_MCU = "enable_mcu";

    public static final byte[] VALUE_ON = "on".getBytes();
    public static final byte[] VALUE_OFF = "off".getBytes();

    private final IDozeHardware mHardware;

    DozeHardware(IDozeHardware hardware) {
        mHardware = hardware;
    }

    /**
     * Sets whether to enable the microcontroller.
     *
     * @param enable If true, enables the MCU otherwise disables it.
     */
    public void setEnableMcu(boolean enable) {
        sendMessage(MSG_ENABLE_MCU, enable ? VALUE_ON : VALUE_OFF);
    }

    /**
     * Sends a message to the doze hardware module.
     *
     * @param msg The name of the message to send.
     * @param arg An optional argument data blob, may be null.
     * @return A result data blob, may be null.
     */
    public byte[] sendMessage(String msg, byte[] arg) {
        if (msg == null) {
            throw new IllegalArgumentException("msg must not be null");
        }

        try {
            return mHardware.sendMessage(msg, arg);
        } catch (RemoteException ex) {
            Log.e(TAG, "Failed to send message to doze hardware module.", ex);
            return null;
        }
    }
}
+0 −25
Original line number Diff line number Diff line
@@ -183,7 +183,6 @@ public class DreamService extends Service implements Window.Callback {
    private boolean mCanDoze;
    private boolean mDozing;
    private boolean mWindowless;
    private DozeHardware mDozeHardware;
    private int mDozeScreenState = Display.STATE_UNKNOWN;
    private int mDozeScreenBrightness = PowerManager.BRIGHTNESS_DEFAULT;

@@ -657,29 +656,6 @@ public class DreamService extends Service implements Window.Callback {
        return mDozing;
    }

    /**
     * Gets an object that may be used to access low-level hardware features that a
     * dream may use to provide a richer user experience while dozing.
     *
     * @return An instance of {@link DozeHardware} or null if this device does not offer
     * hardware support for dozing.
     *
     * @hide For use by system UI components only.
     */
    public DozeHardware getDozeHardware() {
        if (mCanDoze && mDozeHardware == null && mWindowToken != null) {
            try {
                IDozeHardware hardware = mSandman.getDozeHardware(mWindowToken);
                if (hardware != null) {
                    mDozeHardware = new DozeHardware(hardware);
                }
            } catch (RemoteException ex) {
                // system server died
            }
        }
        return mDozeHardware;
    }

    /**
     * Gets the screen state to use while dozing.
     *
@@ -1084,7 +1060,6 @@ public class DreamService extends Service implements Window.Callback {
        else if (canDoze()) pw.print(" candoze");
        pw.println();
        if (canDoze()) {
            pw.println("  doze hardware: " + mDozeHardware);
            pw.println("  doze screen state: " + Display.stateToString(mDozeScreenState));
            pw.println("  doze screen brightness: " + mDozeScreenBrightness);
        }
+0 −24
Original line number Diff line number Diff line
/*
 * Copyright (C) 2014 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 android.service.dreams;

/**
 * @hide
 */
interface IDozeHardware {
    byte[] sendMessage(String msg, in byte[] arg);
}
+0 −2
Original line number Diff line number Diff line
@@ -20,7 +20,6 @@ import android.content.ComponentName;
import android.os.Bundle;
import android.os.ParcelFileDescriptor;
import android.os.IBinder;
import android.service.dreams.IDozeHardware;

/** @hide */
interface IDreamManager {
@@ -34,5 +33,4 @@ interface IDreamManager {
    void finishSelf(in IBinder token, boolean immediate);
    void startDozing(in IBinder token, int screenState, int screenBrightness);
    void stopDozing(in IBinder token);
    IDozeHardware getDozeHardware(in IBinder token);
}
Loading