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

Commit 8ed74bbe authored by Tom Cherry's avatar Tom Cherry
Browse files

Remove ALOGD_IF_SLOW

ALOGD_IF_SLOW isn't intuitively implemented as it cannot handle
temporaries used as its parameters.  Since there are so few users of
it already and since it's just sugar on top of 2 otherwise trivial
lines, we opt to remove it entirely.

Bug: 62820330
Test: Build
Change-Id: I196443b3717497f6cab31bfaee94a229e4838556
parent 51b97163
Loading
Loading
Loading
Loading
+3 −1
Original line number Original line Diff line number Diff line
@@ -24,6 +24,7 @@
#include "android/graphics/Region.h"
#include "android/graphics/Region.h"
#include "core_jni_helpers.h"
#include "core_jni_helpers.h"


#include <android-base/chrono_utils.h>
#include <JNIHelp.h>
#include <JNIHelp.h>
#include <ScopedUtfChars.h>
#include <ScopedUtfChars.h>
#include <android_runtime/android_view_Surface.h>
#include <android_runtime/android_view_Surface.h>
@@ -561,8 +562,9 @@ static void nativeSetDisplayPowerMode(JNIEnv* env, jclass clazz, jobject tokenOb
    sp<IBinder> token(ibinderForJavaObject(env, tokenObj));
    sp<IBinder> token(ibinderForJavaObject(env, tokenObj));
    if (token == NULL) return;
    if (token == NULL) return;


    ALOGD_IF_SLOW(100, "Excessive delay in setPowerMode()");
    android::base::Timer t;
    SurfaceComposerClient::setDisplayPowerMode(token, mode);
    SurfaceComposerClient::setDisplayPowerMode(token, mode);
    if (t.duration() > 100ms) ALOGD("Excessive delay in setPowerMode()");
}
}


static jboolean nativeClearContentFrameStats(JNIEnv* env, jclass clazz, jlong nativeObject) {
static jboolean nativeClearContentFrameStats(JNIEnv* env, jclass clazz, jlong nativeObject) {
+3 −1
Original line number Original line Diff line number Diff line
@@ -22,6 +22,7 @@


#include <android/hardware/light/2.0/ILight.h>
#include <android/hardware/light/2.0/ILight.h>
#include <android/hardware/light/2.0/types.h>
#include <android/hardware/light/2.0/types.h>
#include <android-base/chrono_utils.h>
#include <utils/misc.h>
#include <utils/misc.h>
#include <utils/Log.h>
#include <utils/Log.h>
#include <map>
#include <map>
@@ -178,9 +179,10 @@ static void setLight_native(
        colorARGB, flashMode, onMS, offMS, brightnessMode);
        colorARGB, flashMode, onMS, offMS, brightnessMode);


    {
    {
        ALOGD_IF_SLOW(50, "Excessive delay setting light");
        android::base::Timer t;
        Return<Status> ret = hal->setLight(type, state);
        Return<Status> ret = hal->setLight(type, state);
        processReturn(ret, type, state);
        processReturn(ret, type, state);
        if (t.duration() > 50ms) ALOGD("Excessive delay setting light");
    }
    }
}
}


+14 −6
Original line number Original line Diff line number Diff line
@@ -26,6 +26,7 @@


#include <limits.h>
#include <limits.h>


#include <android-base/chrono_utils.h>
#include <android_runtime/AndroidRuntime.h>
#include <android_runtime/AndroidRuntime.h>
#include <android_runtime/Log.h>
#include <android_runtime/Log.h>
#include <utils/Timers.h>
#include <utils/Timers.h>
@@ -157,22 +158,29 @@ static void nativeReleaseSuspendBlocker(JNIEnv *env, jclass /* clazz */, jstring
static void nativeSetInteractive(JNIEnv* /* env */, jclass /* clazz */, jboolean enable) {
static void nativeSetInteractive(JNIEnv* /* env */, jclass /* clazz */, jboolean enable) {
    std::lock_guard<std::mutex> lock(gPowerHalMutex);
    std::lock_guard<std::mutex> lock(gPowerHalMutex);
    if (getPowerHal()) {
    if (getPowerHal()) {
        String8 err = String8::format(
        android::base::Timer t;
                "Excessive delay in setInteractive(%s) while turning screen %s",
                enable ? "true" : "false", enable ? "on" : "off");
        ALOGD_IF_SLOW(20, err);
        Return<void> ret = gPowerHal->setInteractive(enable);
        Return<void> ret = gPowerHal->setInteractive(enable);
        processReturn(ret, "setInteractive");
        processReturn(ret, "setInteractive");
        if (t.duration() > 20ms) {
            ALOGD("Excessive delay in setInteractive(%s) while turning screen %s",
                  enable ? "true" : "false", enable ? "on" : "off");
        }
    }
    }
}
}


static void nativeSetAutoSuspend(JNIEnv* /* env */, jclass /* clazz */, jboolean enable) {
static void nativeSetAutoSuspend(JNIEnv* /* env */, jclass /* clazz */, jboolean enable) {
    if (enable) {
    if (enable) {
        ALOGD_IF_SLOW(100, "Excessive delay in autosuspend_enable() while turning screen off");
        android::base::Timer t;
        autosuspend_enable();
        autosuspend_enable();
        if (t.duration() > 100ms) {
            ALOGD("Excessive delay in autosuspend_enable() while turning screen off");
        }
    } else {
    } else {
        ALOGD_IF_SLOW(100, "Excessive delay in autosuspend_disable() while turning screen on");
        android::base::Timer t;
        autosuspend_disable();
        autosuspend_disable();
        if (t.duration() > 100ms) {
            ALOGD("Excessive delay in autosuspend_disable() while turning screen on");
        }
    }
    }
}
}