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

Commit 1baab8c3 authored by Suprabh Shukla's avatar Suprabh Shukla
Browse files

Moving alarm manager native code to apex

Extracting out alarm manager jni from libandroid_servers to its own
library.

Test: lunch coral-userdebug && make -j
lunch bertha_arm-userdebug && make -j
atest CtsAlarmManagerTestCases

Bug: 151976605
Change-Id: Ie9e15b2665a2c51c9b2413af304e228f8a3ae2fc
parent 05425133
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -19,4 +19,8 @@ java_library {

    // Rename classes shared with the framework
    jarjar_rules: "jarjar-rules.txt",

    required: [
        "libalarm_jni",
    ],
}
+1 −0
Original line number Diff line number Diff line
@@ -3831,6 +3831,7 @@ public class AlarmManagerService extends SystemService {
        }

        void init() {
            System.loadLibrary("alarm_jni");
            mNativeData = AlarmManagerService.init();
        }

+41 −0
Original line number Diff line number Diff line
cc_library_shared {
    name: "libalarm_jni",

    cpp_std: "c++2a",
    cflags: [
        "-Wall",
        "-Werror",
        "-Wno-unused-parameter",
        "-Wthread-safety",
    ],

    srcs: [
        "com_android_server_alarm_AlarmManagerService.cpp",
        "onload.cpp",
    ],

    shared_libs: [
         "libnativehelper",
         "liblog",
         "libbase",
    ],

    product_variables: {
        arc: {
            exclude_srcs: [
                "com_android_server_alarm_AlarmManagerService.cpp",
            ],
            srcs: [
                ":arctimersrcs",
            ],
        }
    }

}

filegroup {
    name: "lib_alarmManagerService_native",
    srcs: [
        "com_android_server_alarm_AlarmManagerService.cpp",
    ],
}
+41 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2020 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.
 */

#include <nativehelper/JNIHelp.h>
#include "jni.h"
#include "utils/Log.h"
#include "utils/misc.h"

namespace android {
int register_android_server_alarm_AlarmManagerService(JNIEnv* env);
};

using namespace android;

extern "C" jint JNI_OnLoad(JavaVM* vm, void* /* reserved */)
{
    JNIEnv* env = NULL;
    jint result = -1;

    if (vm->GetEnv((void**) &env, JNI_VERSION_1_4) != JNI_OK) {
        ALOGE("GetEnv failed!");
        return result;
    }
    ALOG_ASSERT(env, "Could not retrieve the env!");

    register_android_server_alarm_AlarmManagerService(env);
    return JNI_VERSION_1_4;
}
Loading