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

Commit aede3d1a authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Remove DefaultContainerService and its references." into qt-dev

parents e2bb85d8 ec9f6225
Loading
Loading
Loading
Loading
+0 −7
Original line number Diff line number Diff line
@@ -49,13 +49,6 @@ applications that come with the platform
        <permission name="android.permission.START_ACTIVITIES_FROM_BACKGROUND"/>
    </privapp-permissions>

    <privapp-permissions package="com.android.defcontainer">
        <permission name="android.permission.ACCESS_CACHE_FILESYSTEM"/>
        <permission name="android.permission.ALLOCATE_AGGRESSIVE"/>
        <permission name="android.permission.INTERACT_ACROSS_USERS"/>
        <permission name="android.permission.WRITE_MEDIA_STORAGE"/>
    </privapp-permissions>

    <privapp-permissions package="com.android.externalstorage">
        <permission name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS"/>
        <permission name="android.permission.WRITE_MEDIA_STORAGE"/>
+0 −8
Original line number Diff line number Diff line
android_app {
    name: "DefaultContainerService",
    srcs: ["**/*.java"],
    platform_apis: true,
    jni_libs: ["libdefcontainer_jni"],
    certificate: "platform",
    privileged: true,
}
+0 −23
Original line number Diff line number Diff line
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
        package="com.android.defcontainer" coreApp="true">
    <uses-permission android:name="android.permission.ALLOCATE_AGGRESSIVE"/>
    <uses-permission android:name="android.permission.ASEC_ACCESS"/>
    <uses-permission android:name="android.permission.ASEC_CREATE"/>
    <uses-permission android:name="android.permission.ASEC_DESTROY"/>
    <uses-permission android:name="android.permission.ASEC_MOUNT_UNMOUNT"/>
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.ACCESS_CACHE_FILESYSTEM" />
    <uses-permission android:name="android.permission.INTERACT_ACROSS_USERS" />

    <application android:label="@string/service_name"
                 android:allowBackup="false"
                 android:defaultToDeviceProtectedStorage="true"
                 android:directBootAware="true">

        <service android:name=".DefaultContainerService"
                 android:enabled="true"
                 android:exported="true"
                 android:permission="android.permission.COPY_PROTECTED_DATA"/>
    </application>

</manifest>
+0 −36
Original line number Diff line number Diff line
//
// Copyright (C) 2010 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.
//

cc_library_shared {
    name: "libdefcontainer_jni",

    srcs: ["com_android_defcontainer_MeasurementUtils.cpp"],

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

    static_libs: ["libdiskusage"],

    cflags: [
        "-Wall",
        "-Werror",
        "-Wunused",
        "-Wunreachable-code",
    ],
}
+0 −76
Original line number Diff line number Diff line
/*
 * Copyright (C) 2010 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.
 */

#define LOG_TAG "DefContainer-JNI"

#include <nativehelper/JNIHelp.h>

#include <diskusage/dirsize.h>
#include <utils/Log.h>

#include <sys/types.h>
#include <sys/stat.h>
#include <errno.h>
#include <fcntl.h>
#include <string.h>

namespace android {

static jlong native_measureDirectory(JNIEnv* env, jobject /* clazz */, jstring directory) {
    jlong ret = 0L;

    const char* path = env->GetStringUTFChars(directory, NULL);
    if (path == NULL) {
        return ret;
    }

    int dirfd = open(path, O_DIRECTORY, O_RDONLY);
    if (dirfd < 0) {
        ALOGI("error opening: %s: %s", path, strerror(errno));
    } else {
        ret = calculate_dir_size(dirfd);
        close(dirfd);
    }

    env->ReleaseStringUTFChars(directory, path);

    return ret;
}

static const JNINativeMethod g_methods[] = {
    { "native_measureDirectory", "(Ljava/lang/String;)J", (void*)native_measureDirectory },
};

int register_com_android_defcontainer(JNIEnv *env) {
    if (jniRegisterNativeMethods(
            env, "com/android/defcontainer/MeasurementUtils", g_methods, NELEM(g_methods)) < 0) {
        return JNI_ERR;
    }

    return JNI_VERSION_1_6;
}

} // namespace android

int JNI_OnLoad(JavaVM *jvm, void* /* reserved */) {
    JNIEnv *env;

    if (jvm->GetEnv((void**)&env, JNI_VERSION_1_6)) {
        return JNI_ERR;
    }

    return android::register_com_android_defcontainer(env);
}
Loading