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

Commit 09d30981 authored by Jeff Brown's avatar Jeff Brown
Browse files

resolved conflicts for merge of 6f357d32 to master

Change-Id: I1979e6ed1acddbe656f5010114fd900f10865e75
parents d3ee63b6 6f357d32
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -25,6 +25,20 @@ package android.os;
 * {@hide}
 */
public final class FactoryTest {
    public static final int FACTORY_TEST_OFF = 0;
    public static final int FACTORY_TEST_LOW_LEVEL = 1;
    public static final int FACTORY_TEST_HIGH_LEVEL = 2;

    /**
     * Gets the current factory test mode.
     *
     * @return One of: {@link #FACTORY_TEST_OFF}, {@link #FACTORY_TEST_LOW_LEVEL},
     * or {@link #FACTORY_TEST_HIGH_LEVEL}.
     */
    public static int getMode() {
        return SystemProperties.getInt("ro.factorytest", FACTORY_TEST_OFF);
    }

    /**
     * When true, long-press on power should immediately cause the device to
     * shut down, without prompting the user.
+60 −0
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.os;

import android.view.WindowManagerPolicy;

/**
 * Power manager local system service interface.
 *
 * @hide Only for use within the system server.
 */
public interface PowerManagerInternal {
    /**
     * Used by the window manager to override the screen brightness based on the
     * current foreground activity.
     *
     * This method must only be called by the window manager.
     *
     * @param brightness The overridden brightness, or -1 to disable the override.
     */
    public void setScreenBrightnessOverrideFromWindowManager(int brightness);

    /**
     * Used by the window manager to override the button brightness based on the
     * current foreground activity.
     *
     * This method must only be called by the window manager.
     *
     * @param brightness The overridden brightness, or -1 to disable the override.
     */
    public void setButtonBrightnessOverrideFromWindowManager(int brightness);

    /**
     * Used by the window manager to override the user activity timeout based on the
     * current foreground activity.  It can only be used to make the timeout shorter
     * than usual, not longer.
     *
     * This method must only be called by the window manager.
     *
     * @param timeoutMillis The overridden timeout, or -1 to disable the override.
     */
    public void setUserActivityTimeoutOverrideFromWindowManager(long timeoutMillis);

    // TODO: Remove this and retrieve as a local service instead.
    public void setPolicy(WindowManagerPolicy policy);
}
+7 −2
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@ import android.os.BatteryManager;
import android.os.BatteryStats;
import android.os.FileUtils;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.os.Parcel;
import android.os.ParcelFormatException;
@@ -114,6 +115,10 @@ public final class BatteryStatsImpl extends BatteryStats {
    }

    final class MyHandler extends Handler {
        public MyHandler(Looper looper) {
            super(looper, null, true);
        }

        @Override
        public void handleMessage(Message msg) {
            BatteryCallback cb = mCallback;
@@ -4688,9 +4693,9 @@ public final class BatteryStatsImpl extends BatteryStats {
        }
    }

    public BatteryStatsImpl(String filename) {
    public BatteryStatsImpl(String filename, Handler handler) {
        mFile = new JournaledFile(new File(filename), new File(filename + ".tmp"));
        mHandler = new MyHandler();
        mHandler = new MyHandler(handler.getLooper());
        mStartCount++;
        mScreenOnTimer = new StopwatchTimer(null, -1, null, mUnpluggables);
        for (int i=0; i<NUM_SCREEN_BRIGHTNESS_BINS; i++) {
+1 −0
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ package com.android.internal.os;
import android.os.IBinder;
import android.os.SystemClock;
import android.util.EventLog;

import java.lang.ref.WeakReference;

/**
+15 −4
Original line number Diff line number Diff line
@@ -43,11 +43,18 @@ public class SystemServiceManager {
        mContext = context;
    }

    public void startService(String className) {
    /**
     * Starts a service by name if the class exists, otherwise ignores it.
     *
     * @return The service instance, or null if not found.
     */
    @SuppressWarnings("unchecked")
    public SystemService startServiceIfExists(String className) {
        try {
            startService(Class.forName(className));
            return startService((Class<SystemService>)Class.forName(className));
        } catch (ClassNotFoundException cnfe) {
            Slog.i(TAG, className + " not available, ignoring.");
            return null;
        }
    }

@@ -56,10 +63,12 @@ public class SystemServiceManager {
     * {@link com.android.server.SystemService}.
     *
     * @param serviceClass A Java class that implements the SystemService interface.
     * @return The service instance, never null.
     * @throws RuntimeException if the service fails to start.
     */
    public void startService(Class<?> serviceClass) {
        final SystemService serviceInstance = createInstance(serviceClass);
    @SuppressWarnings("unchecked")
    public <T extends SystemService> T startService(Class<T> serviceClass) {
        final T serviceInstance = (T)createInstance(serviceClass);
        try {
            Slog.i(TAG, "Creating " + serviceClass.getSimpleName());
            serviceInstance.init(mContext, this);
@@ -75,6 +84,8 @@ public class SystemServiceManager {
        } catch (Throwable e) {
            throw new RuntimeException("Failed to start service " + serviceClass.getName(), e);
        }

        return serviceInstance;
    }

    /**
Loading