[
  {
    "path": ".gitignore",
    "content": "*.o\n*.order\n*.o.cmd\n*~\n"
  },
  {
    "path": "Code/device/test/myproduct/AndroidProducts.mk",
    "content": "PRODUCT_MAKEFILES := \\\n\t$(LOCAL_DIR)/myproduct.mk\n"
  },
  {
    "path": "Code/device/test/myproduct/myproduct.mk",
    "content": "# This is a build configuration for a full-featured build of the\n# Open-Source part of the tree. It's geared toward a US-centric\n# build quite specifically for the emulator, and might not be\n# entirely appropriate to inherit from for on-device configurations.\n\n\n$(call inherit-product, $(SRC_TARGET_DIR)/product/aosp_base_telephony.mk)\n$(call inherit-product, $(SRC_TARGET_DIR)/board/generic/device.mk)\n\ninclude $(SRC_TARGET_DIR)/product/emulator.mk\n\n# Overrides\nPRODUCT_NAME := myproduct\nPRODUCT_DEVICE := phdemo\nPRODUCT_BRAND := Android_phdemo\nPRODUCT_MODEL := phdemo AOSP on ARM Emulator\n"
  },
  {
    "path": "Code/device/test/myproduct/phdemo/AndroidBoard.mk",
    "content": "LOCAL_PATH := $(call my-dir)\n"
  },
  {
    "path": "Code/device/test/myproduct/phdemo/BoardConfig.mk",
    "content": "# config.mk\n#\n# Product-specific compile-time definitions.\n#\n\n# The generic product target doesn't have any hardware-specific pieces.\nTARGET_NO_BOOTLOADER := true\nTARGET_NO_KERNEL := true\nTARGET_ARCH := arm\n\n# Note: we build the platform images for ARMv7-A _without_ NEON.\n#\n# Technically, the emulator supports ARMv7-A _and_ NEON instructions, but\n# emulated NEON code paths typically ends up 2x slower than the normal C code\n# it is supposed to replace (unlike on real devices where it is 2x to 3x\n# faster).\n#\n# What this means is that the platform image will not use NEON code paths\n# that are slower to emulate. On the other hand, it is possible to emulate\n# application code generated with the NDK that uses NEON in the emulator.\n#\nTARGET_ARCH_VARIANT := armv7-a\nTARGET_CPU_VARIANT := generic\nTARGET_CPU_ABI := armeabi-v7a\nTARGET_CPU_ABI2 := armeabi\n\nHAVE_HTC_AUDIO_DRIVER := true\nBOARD_USES_GENERIC_AUDIO := true\n\n# no hardware camera\nUSE_CAMERA_STUB := true\n\n# Enable dex-preoptimization to speed up the first boot sequence\n# of an SDK AVD. Note that this operation only works on Linux for now\nifeq ($(HOST_OS),linux)\n  ifeq ($(WITH_DEXPREOPT),)\n    WITH_DEXPREOPT := true\n  endif\nendif\n\n# Build OpenGLES emulation guest and host libraries\nBUILD_EMULATOR_OPENGL := true\n\n# Build and enable the OpenGL ES View renderer. When running on the emulator,\n# the GLES renderer disables itself if host GL acceleration isn't available.\nUSE_OPENGL_RENDERER := true\n\n# Set the phase offset of the system's vsync event relative to the hardware\n# vsync. The system's vsync event drives Choreographer and SurfaceFlinger's\n# rendering. This value is the number of nanoseconds after the hardware vsync\n# that the system vsync event will occur.\n#\n# This phase offset allows adjustment of the minimum latency from application\n# wake-up (by Choregographer) time to the time at which the resulting window\n# image is displayed.  This value may be either positive (after the HW vsync)\n# or negative (before the HW vsync).  Setting it to 0 will result in a\n# minimum latency of two vsync periods because the app and SurfaceFlinger\n# will run just after the HW vsync.  Setting it to a positive number will\n# result in the minimum latency being:\n#\n#     (2 * VSYNC_PERIOD - (vsyncPhaseOffsetNs % VSYNC_PERIOD))\n#\n# Note that reducing this latency makes it more likely for the applications\n# to not have their window content image ready in time.  When this happens\n# the latency will end up being an additional vsync period, and animations\n# will hiccup.  Therefore, this latency should be tuned somewhat\n# conservatively (or at least with awareness of the trade-off being made).\nVSYNC_EVENT_PHASE_OFFSET_NS := 0\n\nTARGET_USERIMAGES_USE_EXT4 := true\nBOARD_SYSTEMIMAGE_PARTITION_SIZE := 1610612736\nBOARD_USERDATAIMAGE_PARTITION_SIZE := 576716800\nBOARD_CACHEIMAGE_PARTITION_SIZE := 69206016\nBOARD_CACHEIMAGE_FILE_SYSTEM_TYPE := ext4\nBOARD_FLASH_BLOCK_SIZE := 512\nTARGET_USERIMAGES_SPARSE_EXT_DISABLED := true\n\nBOARD_SEPOLICY_DIRS += build/target/board/generic/sepolicy\n\nifeq ($(TARGET_PRODUCT),sdk)\n  # include an expanded selection of fonts for the SDK.\n  EXTENDED_FONT_FOOTPRINT := true\nendif\n"
  },
  {
    "path": "Code/device/test/myproduct/phdemo/system.prop",
    "content": "#\n# system.prop for generic sdk \n#\n\nrild.libpath=/system/lib/libreference-ril.so\nrild.libargs=-d /dev/ttyS0\n"
  },
  {
    "path": "Code/device/test/myproduct/vendorsetup.sh",
    "content": "add_lunch_combo myproduct-eng\n"
  },
  {
    "path": "Code/hello_APP/Hello/Android.mk",
    "content": "LOCAL_PATH:= $(call my-dir)\ninclude $(CLEAR_VARS)\nLOCAL_MODULE_TAGS := optional\nLOCAL_SRC_FILES := $(call all-subdir-java-files)\nLOCAL_PACKAGE_NAME := Hello\ninclude $(BUILD_PACKAGE)\n"
  },
  {
    "path": "Code/hello_APP/Hello/AndroidManifest.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<manifest xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    package=\"com.example.phdemo.myapplication\">\n\n    <application\n        android:allowBackup=\"true\"\n        android:icon=\"@mipmap/ic_launcher\"\n        android:label=\"@string/app_name\"\n        android:supportsRtl=\"true\">\n        <activity android:name=\".MainActivity\">\n            <intent-filter>\n                <action android:name=\"android.intent.action.MAIN\" />\n\n                <category android:name=\"android.intent.category.LAUNCHER\" />\n            </intent-filter>\n        </activity>\n    </application>\n\n</manifest>\n"
  },
  {
    "path": "Code/hello_APP/Hello/java/com/example/phdemo/myapplication/MainActivity.java",
    "content": "package com.example.phdemo.myapplication;\n\nimport android.os.RemoteException;\nimport android.app.Activity;\nimport android.os.ServiceManager;\nimport android.os.Bundle;\nimport android.os.IHelloService;\nimport android.os.RemoteException;\nimport android.util.Log;\nimport android.view.View;\nimport android.view.View.OnClickListener;\nimport android.widget.Button;\nimport android.widget.EditText;\n\npublic class MainActivity extends Activity implements View.OnClickListener {\n\n    private final static String LOG_TAG = \"shy.luo.renju.Hello\";\n\n    private IHelloService helloService = null;\n\n    private EditText valueText = null;\n    private Button readButton = null;\n    private Button writeButton = null;\n    private Button clearButton = null;\n\n    /** Called when the activity is first created. */\n    @Override\n    public void onCreate(Bundle savedInstanceState) {\n        super.onCreate(savedInstanceState);\n        setContentView(R.layout.activity_main);\n\n        helloService = IHelloService.Stub.asInterface(\n                ServiceManager.getService(\"hello\"));\n\n        valueText = (EditText)findViewById(R.id.edit_value);\n        readButton = (Button)findViewById(R.id.button_read);\n        writeButton = (Button)findViewById(R.id.button_write);\n        clearButton = (Button)findViewById(R.id.button_clear);\n\n        readButton.setOnClickListener(this);\n        writeButton.setOnClickListener(this);\n        clearButton.setOnClickListener(this);\n\n        Log.i(LOG_TAG, \"Hello Activity Created\");\n    }\n\n    @Override\n    public void onClick(View v) {\n        if(v.equals(readButton)) {\n            try {\n                int val = helloService.getVal();\n                String text = String.valueOf(val);\n                valueText.setText(text);\n            } catch (RemoteException e) {\n                Log.e(LOG_TAG, \"Remote Exception while reading value from device.\");\n            }\n        }\n        else if(v.equals(writeButton)) {\n            try {\n                String text = valueText.getText().toString();\n                int val = Integer.parseInt(text);\n                helloService.setVal(val);\n            } catch (RemoteException e) {\n                Log.e(LOG_TAG, \"Remote Exception while writing value to device.\");\n            }\n        }\n        else if(v.equals(clearButton)) {\n            String text = \"\";\n            valueText.setText(text);\n        }\n    }\n}\n"
  },
  {
    "path": "Code/hello_APP/Hello/res/layout/activity_main.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<LinearLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\nandroid:orientation=\"vertical\"\nandroid:layout_width=\"fill_parent\"\nandroid:layout_height=\"fill_parent\">\n<LinearLayout\n    android:layout_width=\"fill_parent\"\n    android:layout_height=\"wrap_content\"\n    android:orientation=\"vertical\"\n    android:gravity=\"center\">\n    <TextView\n        android:layout_width=\"wrap_content\"\n        android:layout_height=\"60dp\"\n        android:text=\"@string/value\"\n        android:textSize=\"50dp\">\n    </TextView>\n    <EditText\n        android:layout_width=\"fill_parent\"\n        android:layout_height=\"wrap_content\"\n        android:id=\"@+id/edit_value\"\n        android:hint=\"@string/hint\">\n    </EditText>\n</LinearLayout>\n<LinearLayout\n    android:layout_width=\"fill_parent\"\n    android:layout_height=\"wrap_content\"\n    android:orientation=\"horizontal\"\n    android:gravity=\"center\">\n    <Button\n        android:id=\"@+id/button_read\"\n        android:layout_width=\"wrap_content\"\n        android:layout_height=\"wrap_content\"\n        android:text=\"@string/read\">\n    </Button>\n    <Button\n        android:id=\"@+id/button_write\"\n        android:layout_width=\"wrap_content\"\n        android:layout_height=\"wrap_content\"\n        android:text=\"@string/write\">\n    </Button>\n    <Button\n        android:id=\"@+id/button_clear\"\n        android:layout_width=\"wrap_content\"\n        android:layout_height=\"wrap_content\"\n        android:text=\"@string/clear\">\n    </Button>\n</LinearLayout>\n</LinearLayout>"
  },
  {
    "path": "Code/hello_APP/Hello/res/values/colors.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<resources>\n    <color name=\"colorPrimary\">#3F51B5</color>\n    <color name=\"colorPrimaryDark\">#303F9F</color>\n    <color name=\"colorAccent\">#FF4081</color>\n</resources>\n"
  },
  {
    "path": "Code/hello_APP/Hello/res/values/dimens.xml",
    "content": "<resources>\n    <!-- Default screen margins, per the Android Design guidelines. -->\n    <dimen name=\"activity_horizontal_margin\">16dp</dimen>\n    <dimen name=\"activity_vertical_margin\">16dp</dimen>\n</resources>\n"
  },
  {
    "path": "Code/hello_APP/Hello/res/values/strings.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<resources>\n    <string name=\"app_name\">Hello</string>\n    <string name=\"value\">Value</string>\n    <string name=\"hint\">Please input a value...</string>\n    <string name=\"read\">Read</string>\n    <string name=\"write\">Write</string>\n    <string name=\"clear\">Clear</string>\n</resources>"
  },
  {
    "path": "Code/hello_APP/Hello/res/values-w820dp/dimens.xml",
    "content": "<resources>\n    <!-- Example customization of dimensions originally defined in res/values/dimens.xml\n         (such as screen margins) for screens with more than 820dp of available width. This\n         would include 7\" and 10\" devices in landscape (~960dp and ~1280dp respectively). -->\n    <dimen name=\"activity_horizontal_margin\">64dp</dimen>\n</resources>\n"
  },
  {
    "path": "Code/hello_Execute/Android.mk",
    "content": "LOCAL_PATH := $(call my-dir)\ninclude $(CLEAR_VARS)\nLOCAL_MODULE_TAGS := optional\nLOCAL_MODULE := hello\nLOCAL_SRC_FILES := $(call all-subdir-c-files)\ninclude $(BUILD_EXECUTABLE)\n"
  },
  {
    "path": "Code/hello_Execute/hello.c",
    "content": "#include <stdio.h>  \n#include <stdlib.h>  \n#include <fcntl.h>  \n#define DEVICE_NAME \"/dev/hello\"  \nint main(int argc, char** argv)  \n{  \n    int fd = -1;  \n    int val = 0;  \n    fd = open(DEVICE_NAME, O_RDWR);  \n    if(fd == -1) {  \n        printf(\"Failed to open device %s.\\n\", DEVICE_NAME);  \n        return -1;  \n    }  \n      \n    printf(\"Read original value:\\n\");  \n    read(fd, &val, sizeof(val));  \n    printf(\"%d.\\n\\n\", val);  \n    val = 5;  \n    printf(\"Write value %d to %s.\\n\\n\", val, DEVICE_NAME);  \n        write(fd, &val, sizeof(val));  \n      \n    printf(\"Read the value again:\\n\");  \n        read(fd, &val, sizeof(val));  \n        printf(\"%d.\\n\\n\", val);  \n    close(fd);  \n    return 0;  \n}  \n"
  },
  {
    "path": "Code/hello_Framework/HelloService.java",
    "content": "package com.android.server;  \nimport android.content.Context;  \nimport android.os.IHelloService;  \nimport android.util.Slog;  \n\npublic class HelloService extends IHelloService.Stub {  \n    private static final String TAG = \"HelloService\";  \n    HelloService() {  \n        init_native();  \n    }  \n    public void setVal(int val) {  \n        setVal_native(val);  \n    }     \n    public int getVal() {  \n        return getVal_native();  \n    }  \n      \n    private static native boolean init_native();  \n        private static native void setVal_native(int val);  \n    private static native int getVal_native();  \n};  \n"
  },
  {
    "path": "Code/hello_Framework/IHelloService.aidl",
    "content": "package android.os;  \n   \ninterface IHelloService {  \n    void setVal(int val);  \n    int getVal();  \n}  \n"
  },
  {
    "path": "Code/hello_Framework/sepolicy/device.te",
    "content": "# Device types\ntype device, dev_type, fs_type;\ntype alarm_device, dev_type, mlstrustedobject;\ntype adb_device, dev_type;\ntype ashmem_device, dev_type, mlstrustedobject;\ntype audio_device, dev_type;\ntype binder_device, dev_type, mlstrustedobject;\ntype block_device, dev_type;\ntype camera_device, dev_type;\ntype dm_device, dev_type;\ntype loop_device, dev_type;\ntype pmsg_device, dev_type, mlstrustedobject;\ntype radio_device, dev_type;\ntype ram_device, dev_type;\ntype rtc_device, dev_type;\ntype vold_device, dev_type;\ntype console_device, dev_type;\ntype cpuctl_device, dev_type;\ntype fscklogs, dev_type;\ntype full_device, dev_type;\n# GPU (used by most UI apps)\ntype gpu_device, dev_type, mlstrustedobject;\ntype graphics_device, dev_type;\ntype hw_random_device, dev_type;\ntype input_device, dev_type;\ntype kmem_device, dev_type;\ntype log_device, dev_type, mlstrustedobject;\ntype mtd_device, dev_type;\ntype mtp_device, dev_type, mlstrustedobject;\ntype nfc_device, dev_type;\ntype ptmx_device, dev_type, mlstrustedobject;\ntype kmsg_device, dev_type;\ntype null_device, dev_type, mlstrustedobject;\ntype random_device, dev_type, mlstrustedobject;\ntype sensors_device, dev_type;\ntype serial_device, dev_type;\ntype socket_device, dev_type;\ntype owntty_device, dev_type, mlstrustedobject;\ntype tty_device, dev_type;\ntype urandom_device, dev_type, mlstrustedobject;\ntype video_device, dev_type;\ntype vcs_device, dev_type;\ntype zero_device, dev_type, mlstrustedobject;\ntype fuse_device, dev_type;\ntype iio_device, dev_type;\ntype ion_device, dev_type, mlstrustedobject;\ntype gps_device, dev_type;\ntype qtaguid_device, dev_type;\ntype watchdog_device, dev_type;\ntype uhid_device, dev_type;\ntype uio_device, dev_type;\ntype tun_device, dev_type, mlstrustedobject;\ntype usbaccessory_device, dev_type, mlstrustedobject;\ntype usb_device, dev_type, mlstrustedobject;\ntype klog_device, dev_type;\ntype properties_device, dev_type;\n\n# All devices have a uart for the hci\n# attach service. The uart dev node\n# varies per device. This type\n# is used in per device policy\ntype hci_attach_dev, dev_type;\n\n# All devices have a rpmsg device for\n# achieving remoteproc and rpmsg modules\ntype rpmsg_device, dev_type;\n\n# Partition layout block device\ntype root_block_device, dev_type;\n\n# factory reset protection block device\ntype frp_block_device, dev_type;\n\n# System block device mounted on /system.\ntype system_block_device, dev_type;\n\n# Recovery block device.\ntype recovery_block_device, dev_type;\n\n# boot block device.\ntype boot_block_device, dev_type;\n\n# Userdata block device mounted on /data.\ntype userdata_block_device, dev_type;\n\n# Cache block device mounted on /cache.\ntype cache_block_device, dev_type;\n\n# Block device for any swap partition.\ntype swap_block_device, dev_type;\n\n# Metadata block device used for encryption metadata.\n# Assign this type to the partition specified by the encryptable=\n# mount option in your fstab file in the entry for userdata.\ntype metadata_block_device, dev_type;\n\n#add by aggresss\ntype hello_device, dev_type;\n"
  },
  {
    "path": "Code/hello_Framework/sepolicy/file_contexts",
    "content": "###########################################\n# Root\n/\t\t\tu:object_r:rootfs:s0\n\n# Data files\n/adb_keys\t\tu:object_r:adb_keys_file:s0\n/default\\.prop\t\tu:object_r:rootfs:s0\n/fstab\\..*\t\tu:object_r:rootfs:s0\n/init\\..*\t\tu:object_r:rootfs:s0\n/res(/.*)?\t\tu:object_r:rootfs:s0\n/ueventd\\..*\t\tu:object_r:rootfs:s0\n\n# Executables\n/charger\t\tu:object_r:rootfs:s0\n/init\t\t\tu:object_r:init_exec:s0\n/sbin(/.*)?\t\tu:object_r:rootfs:s0\n\n# Empty directories\n/lost\\+found\t\tu:object_r:rootfs:s0\n/proc\t\t\tu:object_r:rootfs:s0\n\n# SELinux policy files\n/file_contexts\t\tu:object_r:rootfs:s0\n/property_contexts\tu:object_r:rootfs:s0\n/seapp_contexts\t\tu:object_r:rootfs:s0\n/sepolicy\t\tu:object_r:rootfs:s0\n\n##########################\n# Devices\n#\n/dev(/.*)?\t\tu:object_r:device:s0\n/dev/akm8973.*\t\tu:object_r:sensors_device:s0\n/dev/accelerometer\tu:object_r:sensors_device:s0\n/dev/adf[0-9]*\t\tu:object_r:graphics_device:s0\n/dev/adf-interface[0-9]*\\.[0-9]*\tu:object_r:graphics_device:s0\n/dev/adf-overlay-engine[0-9]*\\.[0-9]*\tu:object_r:graphics_device:s0\n/dev/alarm\t\tu:object_r:alarm_device:s0\n/dev/android_adb.*\tu:object_r:adb_device:s0\n/dev/ashmem\t\tu:object_r:ashmem_device:s0\n/dev/audio.*\t\tu:object_r:audio_device:s0\n/dev/binder\t\tu:object_r:binder_device:s0\n/dev/block(/.*)?\tu:object_r:block_device:s0\n/dev/block/dm-[0-9]+\tu:object_r:dm_device:s0\n/dev/block/loop[0-9]*\tu:object_r:loop_device:s0\n/dev/block/vold/.+\tu:object_r:vold_device:s0\n/dev/block/ram[0-9]*\tu:object_r:ram_device:s0\n/dev/bus/usb(.*)?       u:object_r:usb_device:s0\n/dev/cam\t\tu:object_r:camera_device:s0\n/dev/console\t\tu:object_r:console_device:s0\n/dev/cpuctl(/.*)?\tu:object_r:cpuctl_device:s0\n/dev/device-mapper\tu:object_r:dm_device:s0\n/dev/eac\t\tu:object_r:audio_device:s0\n/dev/fscklogs(/.*)?\tu:object_r:fscklogs:s0\n/dev/full\t\tu:object_r:full_device:s0\n/dev/fuse\t\tu:object_r:fuse_device:s0\n/dev/graphics(/.*)?\tu:object_r:graphics_device:s0\n/dev/hw_random\t\tu:object_r:hw_random_device:s0\n/dev/input(/.*)\t\tu:object_r:input_device:s0\n/dev/iio:device[0-9]+   u:object_r:iio_device:s0\n/dev/ion\t\tu:object_r:ion_device:s0\n/dev/kmem\t\tu:object_r:kmem_device:s0\n/dev/log(/.*)?\t\tu:object_r:log_device:s0\n/dev/mem\t\tu:object_r:kmem_device:s0\n/dev/modem.*\t\tu:object_r:radio_device:s0\n/dev/mpu\t\tu:object_r:gps_device:s0\n/dev/mpuirq\t\tu:object_r:gps_device:s0\n/dev/mtd(/.*)?\t\tu:object_r:mtd_device:s0\n/dev/mtp_usb\t\tu:object_r:mtp_device:s0\n/dev/pmsg0\t\tu:object_r:pmsg_device:s0\n/dev/pn544\t\tu:object_r:nfc_device:s0\n/dev/ppp\t\tu:object_r:ppp_device:s0\n/dev/ptmx\t\tu:object_r:ptmx_device:s0\n/dev/pvrsrvkm\t\tu:object_r:gpu_device:s0\n/dev/kmsg\t\tu:object_r:kmsg_device:s0\n/dev/null\t\tu:object_r:null_device:s0\n/dev/nvhdcp1\t\tu:object_r:video_device:s0\n/dev/random\t\tu:object_r:random_device:s0\n/dev/rpmsg-omx[0-9]\tu:object_r:rpmsg_device:s0\n/dev/rproc_user\tu:object_r:rpmsg_device:s0\n/dev/rtc[0-9]      u:object_r:rtc_device:s0\n/dev/snd(/.*)?\t\tu:object_r:audio_device:s0\n/dev/socket(/.*)?\tu:object_r:socket_device:s0\n/dev/socket/adbd\tu:object_r:adbd_socket:s0\n/dev/socket/sap_uim_socket[0-9]        u:object_r:sap_uim_socket:s0\n/dev/socket/cryptd\tu:object_r:vold_socket:s0\n/dev/socket/dnsproxyd\tu:object_r:dnsproxyd_socket:s0\n/dev/socket/dumpstate\tu:object_r:dumpstate_socket:s0\n/dev/socket/fwmarkd\tu:object_r:fwmarkd_socket:s0\n/dev/socket/gps\t\tu:object_r:gps_socket:s0\n/dev/socket/installd\tu:object_r:installd_socket:s0\n/dev/socket/lmkd        u:object_r:lmkd_socket:s0\n/dev/socket/logd\tu:object_r:logd_socket:s0\n/dev/socket/logdr\tu:object_r:logdr_socket:s0\n/dev/socket/logdw\tu:object_r:logdw_socket:s0\n/dev/socket/mdns\tu:object_r:mdns_socket:s0\n/dev/socket/mdnsd\tu:object_r:mdnsd_socket:s0\n/dev/socket/mtpd\tu:object_r:mtpd_socket:s0\n/dev/socket/netd\tu:object_r:netd_socket:s0\n/dev/socket/property_service\tu:object_r:property_socket:s0\n/dev/socket/racoon\tu:object_r:racoon_socket:s0\n/dev/socket/rild\tu:object_r:rild_socket:s0\n/dev/socket/rild-debug\tu:object_r:rild_debug_socket:s0\n/dev/socket/vold\tu:object_r:vold_socket:s0\n/dev/socket/wpa_eth[0-9] u:object_r:wpa_socket:s0\n/dev/socket/wpa_wlan[0-9] u:object_r:wpa_socket:s0\n/dev/socket/zygote\tu:object_r:zygote_socket:s0\n/dev/socket/zygote_secondary\tu:object_r:zygote_socket:s0\n/dev/spdif_out.*\tu:object_r:audio_device:s0\n/dev/tegra.*\t\tu:object_r:video_device:s0\n/dev/tf_driver\t\tu:object_r:tee_device:s0\n/dev/tty\t\tu:object_r:owntty_device:s0\n/dev/tty[0-9]*\t\tu:object_r:tty_device:s0\n/dev/ttyS[0-9]*\t\tu:object_r:serial_device:s0\n/dev/tun\t\tu:object_r:tun_device:s0\n/dev/uhid\t\tu:object_r:uhid_device:s0\n/dev/uinput\t\tu:object_r:uhid_device:s0\n/dev/uio[0-9]*\t\tu:object_r:uio_device:s0\n/dev/urandom\t\tu:object_r:urandom_device:s0\n/dev/usb_accessory\tu:object_r:usbaccessory_device:s0\n/dev/vcs[0-9a-z]*\tu:object_r:vcs_device:s0\n/dev/video[0-9]*\tu:object_r:video_device:s0\n/dev/watchdog\t\tu:object_r:watchdog_device:s0\n/dev/xt_qtaguid\tu:object_r:qtaguid_device:s0\n/dev/zero\t\tu:object_r:zero_device:s0\n/dev/__kmsg__\t\tu:object_r:klog_device:s0\n/dev/__properties__ u:object_r:properties_device:s0\n#add by aggresss\n/dev/hello\t\tu:object_r:hello_device:s0\n#############################\n# System files\n#\n/system(/.*)?\t\tu:object_r:system_file:s0\n/system/bin/e2fsck\t--\tu:object_r:fsck_exec:s0\n/system/bin/fsck\\.f2fs\t--\tu:object_r:fsck_exec:s0\n/system/bin/fsck_msdos\t--\tu:object_r:fsck_exec:s0\n/system/bin/toolbox\t--\tu:object_r:toolbox_exec:s0\n/system/bin/toybox\t--\tu:object_r:toolbox_exec:s0\n/system/bin/logcat\t--\tu:object_r:logcat_exec:s0\n/system/bin/sh\t\t--\tu:object_r:shell_exec:s0\n/system/bin/run-as\t--\tu:object_r:runas_exec:s0\n/system/bin/bootanimation u:object_r:bootanim_exec:s0\n/system/bin/app_process32\tu:object_r:zygote_exec:s0\n/system/bin/app_process64\tu:object_r:zygote_exec:s0\n/system/bin/servicemanager\tu:object_r:servicemanager_exec:s0\n/system/bin/surfaceflinger\tu:object_r:surfaceflinger_exec:s0\n/system/bin/drmserver\tu:object_r:drmserver_exec:s0\n/system/bin/dumpstate   u:object_r:dumpstate_exec:s0\n/system/bin/vold\tu:object_r:vold_exec:s0\n/system/bin/netd\tu:object_r:netd_exec:s0\n/system/bin/rild\tu:object_r:rild_exec:s0\n/system/bin/mediaserver\tu:object_r:mediaserver_exec:s0\n/system/bin/mdnsd\tu:object_r:mdnsd_exec:s0\n/system/bin/installd\tu:object_r:installd_exec:s0\n/system/bin/keystore\tu:object_r:keystore_exec:s0\n/system/bin/fingerprintd u:object_r:fingerprintd_exec:s0\n/system/bin/gatekeeperd u:object_r:gatekeeperd_exec:s0\n/system/bin/debuggerd\tu:object_r:debuggerd_exec:s0\n/system/bin/debuggerd64\tu:object_r:debuggerd_exec:s0\n/system/bin/wpa_supplicant\tu:object_r:wpa_exec:s0\n/system/bin/sdcard      u:object_r:sdcardd_exec:s0\n/system/bin/dhcpcd      u:object_r:dhcp_exec:s0\n/system/bin/mtpd\tu:object_r:mtp_exec:s0\n/system/bin/pppd\tu:object_r:ppp_exec:s0\n/system/bin/tf_daemon\tu:object_r:tee_exec:s0\n/system/bin/racoon\tu:object_r:racoon_exec:s0\n/system/xbin/su\t\tu:object_r:su_exec:s0\n/system/xbin/procrank   u:object_r:procrank_exec:s0\n/system/xbin/perfprofd  u:object_r:perfprofd_exec:s0\n/system/xbin/simpleperf u:object_r:system_file:s0\n/system/vendor/bin/gpsd u:object_r:gpsd_exec:s0\n/system/bin/dnsmasq     u:object_r:dnsmasq_exec:s0\n/system/bin/hostapd     u:object_r:hostapd_exec:s0\n/system/bin/clatd\tu:object_r:clatd_exec:s0\n/system/bin/lmkd        u:object_r:lmkd_exec:s0\n/system/bin/inputflinger u:object_r:inputflinger_exec:s0\n/system/bin/logd        u:object_r:logd_exec:s0\n/system/bin/uncrypt     u:object_r:uncrypt_exec:s0\n/system/bin/logwrapper  u:object_r:system_file:s0\n/system/bin/vdc         u:object_r:vdc_exec:s0\n/system/bin/install-recovery.sh u:object_r:install_recovery_exec:s0\n/system/bin/dex2oat     u:object_r:dex2oat_exec:s0\n# patchoat executable has (essentially) the same requirements as dex2oat.\n/system/bin/patchoat    u:object_r:dex2oat_exec:s0\n/system/bin/sgdisk      u:object_r:sgdisk_exec:s0\n/system/bin/blkid       u:object_r:blkid_exec:s0\n/system/bin/tzdatacheck u:object_r:tzdatacheck_exec:s0\n\n#############################\n# Vendor files\n#\n/vendor(/.*)?\t\tu:object_r:system_file:s0\n/vendor/bin/gpsd\tu:object_r:gpsd_exec:s0\n\n#############################\n# OEM and ODM files\n#\n/odm(/.*)?              u:object_r:system_file:s0\n/oem(/.*)?              u:object_r:oemfs:s0\n\n\n#############################\n# Data files\n#\n# NOTE: When modifying existing label rules, changes may also need to\n# propagate to the \"Expanded data files\" section.\n#\n/data(/.*)?\t\tu:object_r:system_data_file:s0\n/data/.layout_version\t\tu:object_r:install_data_file:s0\n/data/unencrypted(/.*)?         u:object_r:unencrypted_data_file:s0\n/data/backup(/.*)?\t\tu:object_r:backup_data_file:s0\n/data/secure/backup(/.*)?\tu:object_r:backup_data_file:s0\n/data/security(/.*)?\tu:object_r:security_file:s0\n/data/system/ndebugsocket\tu:object_r:system_ndebug_socket:s0\n/data/drm(/.*)?\t\tu:object_r:drm_data_file:s0\n/data/gps(/.*)?\t\tu:object_r:gps_data_file:s0\n/data/resource-cache(/.*)? u:object_r:resourcecache_data_file:s0\n/data/dalvik-cache(/.*)? u:object_r:dalvikcache_data_file:s0\n/data/dalvik-cache/profiles(/.*)? u:object_r:dalvikcache_profiles_data_file:s0\n/data/adb(/.*)?\t\tu:object_r:adb_data_file:s0\n/data/anr(/.*)?\t\tu:object_r:anr_data_file:s0\n/data/app(/.*)?                       u:object_r:apk_data_file:s0\n/data/app/[^/]+/oat(/.*)?                u:object_r:dalvikcache_data_file:s0\n/data/app/vmdl[^/]+\\.tmp(/.*)?           u:object_r:apk_tmp_file:s0\n/data/app/vmdl[^/]+\\.tmp/oat(/.*)?           u:object_r:dalvikcache_data_file:s0\n/data/app-private(/.*)?               u:object_r:apk_private_data_file:s0\n/data/app-private/vmdl.*\\.tmp(/.*)?   u:object_r:apk_private_tmp_file:s0\n/data/tombstones(/.*)?\tu:object_r:tombstone_data_file:s0\n/data/local/tmp(/.*)?\tu:object_r:shell_data_file:s0\n/data/media(/.*)?\tu:object_r:media_rw_data_file:s0\n/data/mediadrm(/.*)?\tu:object_r:media_data_file:s0\n/data/property(/.*)?\tu:object_r:property_data_file:s0\n\n# Misc data\n/data/misc/adb(/.*)?            u:object_r:adb_keys_file:s0\n/data/misc/audio(/.*)?          u:object_r:audio_data_file:s0\n/data/misc/bluetooth(/.*)?      u:object_r:bluetooth_data_file:s0\n/data/misc/bluedroid(/.*)?      u:object_r:bluetooth_data_file:s0\n/data/misc/bluedroid/\\.a2dp_ctrl u:object_r:bluetooth_socket:s0\n/data/misc/bluedroid/\\.a2dp_data u:object_r:bluetooth_socket:s0\n/data/misc/camera(/.*)?         u:object_r:camera_data_file:s0\n/data/misc/dhcp(/.*)?           u:object_r:dhcp_data_file:s0\n/data/misc/gatekeeper(/.*)?     u:object_r:gatekeeper_data_file:s0\n/data/misc/keychain(/.*)?       u:object_r:keychain_data_file:s0\n/data/misc/keystore(/.*)?       u:object_r:keystore_data_file:s0\n/data/misc/logd(/.*)?           u:object_r:misc_logd_file:s0\n/data/misc/media(/.*)?          u:object_r:media_data_file:s0\n/data/misc/net(/.*)?            u:object_r:net_data_file:s0\n/data/misc/shared_relro(/.*)?   u:object_r:shared_relro_file:s0\n/data/misc/sms(/.*)?            u:object_r:radio_data_file:s0\n/data/misc/systemkeys(/.*)?     u:object_r:systemkeys_data_file:s0\n/data/misc/user(/.*)?           u:object_r:misc_user_data_file:s0\n/data/misc/vpn(/.*)?            u:object_r:vpn_data_file:s0\n/data/misc/wifi(/.*)?           u:object_r:wifi_data_file:s0\n/data/misc/wifi/sockets(/.*)?   u:object_r:wpa_socket:s0\n/data/misc/wifi/sockets/wpa_ctrl.*   u:object_r:system_wpa_socket:s0\n/data/misc/wifi/hostapd(/.*)?   u:object_r:wpa_socket:s0\n/data/misc/zoneinfo(/.*)?       u:object_r:zoneinfo_data_file:s0\n/data/misc/vold(/.*)?           u:object_r:vold_data_file:s0\n/data/misc/perfprofd(/.*)?      u:object_r:perfprofd_data_file:s0\n/data/system/heapdump(/.*)?     u:object_r:heapdump_data_file:s0\n\n# Fingerprint data\n/data/system/users/[0-9]+/fpdata(/.*)? u:object_r:fingerprintd_data_file:s0\n\n# Bootchart data\n/data/bootchart(/.*)?\t\tu:object_r:bootchart_data_file:s0\n\n#############################\n# Expanded data files\n#\n/mnt/expand(/.*)?                                   u:object_r:mnt_expand_file:s0\n/mnt/expand/[^/]+(/.*)?                             u:object_r:system_data_file:s0\n/mnt/expand/[^/]+/app(/.*)?                         u:object_r:apk_data_file:s0\n/mnt/expand/[^/]+/app/[^/]+/oat(/.*)?               u:object_r:dalvikcache_data_file:s0\n/mnt/expand/[^/]+/app/vmdl[^/]+\\.tmp(/.*)?          u:object_r:apk_tmp_file:s0\n/mnt/expand/[^/]+/app/vmdl[^/]+\\.tmp/oat(/.*)?      u:object_r:dalvikcache_data_file:s0\n/mnt/expand/[^/]+/local/tmp(/.*)?                   u:object_r:shell_data_file:s0\n/mnt/expand/[^/]+/media(/.*)?                       u:object_r:media_rw_data_file:s0\n/mnt/expand/[^/]+/misc/vold(/.*)?                   u:object_r:vold_data_file:s0\n\n# coredump directory for userdebug/eng devices\n/cores(/.*)?                    u:object_r:coredump_file:s0\n\n# Wallpaper file for other users\n/data/system/users/[0-9]+/wallpaper\t\tu:object_r:wallpaper_file:s0\n#############################\n# efs files\n#\n/efs(/.*)?\t\tu:object_r:efs_file:s0\n#############################\n# Cache files\n#\n/cache(/.*)?\t\tu:object_r:cache_file:s0\n/cache/.*\\.data\tu:object_r:cache_backup_file:s0\n/cache/.*\\.restore\tu:object_r:cache_backup_file:s0\n# LocalTransport (backup) uses this directory\n/cache/backup(/.*)?\tu:object_r:cache_backup_file:s0\n#############################\n# sysfs files\n#\n/sys/devices/platform/nfc-power/nfc_power -- u:object_r:sysfs_nfc_power_writable:s0\n/sys/devices/system/cpu(/.*)?    u:object_r:sysfs_devices_system_cpu:s0\n/sys/power/wake_lock -- u:object_r:sysfs_wake_lock:s0\n/sys/power/wake_unlock -- u:object_r:sysfs_wake_lock:s0\n/sys/kernel/uevent_helper --\tu:object_r:usermodehelper:s0\n/sys/module/lowmemorykiller(/.*)? -- u:object_r:sysfs_lowmemorykiller:s0\n\n#############################\n# asec containers\n/mnt/asec(/.*)?             u:object_r:asec_apk_file:s0\n/mnt/asec/[^/]+/[^/]+\\.zip  u:object_r:asec_public_file:s0\n/mnt/asec/[^/]+/lib(/.*)?   u:object_r:asec_public_file:s0\n/data/app-asec(/.*)?        u:object_r:asec_image_file:s0\n\n#############################\n# external storage\n/mnt/media_rw(/.*)?         u:object_r:mnt_media_rw_file:s0\n/mnt/user(/.*)?             u:object_r:mnt_user_file:s0\n/mnt/runtime(/.*)?          u:object_r:storage_file:s0\n/storage(/.*)?              u:object_r:storage_file:s0\n"
  },
  {
    "path": "Code/hello_Framework/sepolicy/service.te",
    "content": "type bluetooth_service,         service_manager_type;\ntype default_android_service,   service_manager_type;\ntype drmserver_service,         service_manager_type;\ntype gatekeeper_service,        app_api_service, service_manager_type;\ntype fingerprintd_service,      service_manager_type;\ntype healthd_service,           service_manager_type;\ntype inputflinger_service,      service_manager_type;\ntype keystore_service,          service_manager_type;\ntype mediaserver_service,       service_manager_type;\ntype nfc_service,               service_manager_type;\ntype radio_service,             service_manager_type;\ntype surfaceflinger_service,    service_manager_type;\ntype system_app_service,        service_manager_type;\n\n# system_server_services broken down\ntype accessibility_service, app_api_service, system_server_service, service_manager_type;\ntype account_service, app_api_service, system_server_service, service_manager_type;\ntype activity_service, app_api_service, system_server_service, service_manager_type;\ntype alarm_service, app_api_service, system_server_service, service_manager_type;\ntype appops_service, app_api_service, system_server_service, service_manager_type;\ntype appwidget_service, app_api_service, system_server_service, service_manager_type;\ntype assetatlas_service, app_api_service, system_server_service, service_manager_type;\ntype audio_service, app_api_service, system_server_service, service_manager_type;\ntype backup_service, app_api_service, system_server_service, service_manager_type;\ntype batterystats_service, app_api_service, system_server_service, service_manager_type;\ntype battery_service, system_server_service, service_manager_type;\ntype bluetooth_manager_service, system_api_service, system_server_service, service_manager_type;\ntype cameraproxy_service, system_server_service, service_manager_type;\ntype clipboard_service, app_api_service, system_server_service, service_manager_type;\ntype IProxyService_service, system_api_service, system_server_service, service_manager_type;\ntype commontime_management_service, system_server_service, service_manager_type;\ntype connectivity_service, app_api_service, system_server_service, service_manager_type;\ntype consumer_ir_service, app_api_service, system_server_service, service_manager_type;\ntype content_service, app_api_service, system_server_service, service_manager_type;\ntype country_detector_service, system_api_service, system_server_service, service_manager_type;\ntype cpuinfo_service, system_api_service, system_server_service, service_manager_type;\ntype dbinfo_service, system_api_service, system_server_service, service_manager_type;\ntype device_policy_service, app_api_service, system_server_service, service_manager_type;\ntype deviceidle_service, system_api_service, system_server_service, service_manager_type;\ntype devicestoragemonitor_service, system_server_service, service_manager_type;\ntype diskstats_service, system_api_service, system_server_service, service_manager_type;\ntype display_service, app_api_service, system_server_service, service_manager_type;\ntype DockObserver_service, system_server_service, service_manager_type;\ntype dreams_service, system_api_service, system_server_service, service_manager_type;\ntype dropbox_service, app_api_service, system_server_service, service_manager_type;\ntype ethernet_service, app_api_service, system_server_service, service_manager_type;\ntype fingerprint_service, app_api_service, system_server_service, service_manager_type;\ntype gfxinfo_service, system_api_service, system_server_service, service_manager_type;\ntype graphicsstats_service, app_api_service, system_server_service, service_manager_type;\ntype hardware_service, system_server_service, service_manager_type;\ntype hdmi_control_service, system_api_service, system_server_service, service_manager_type;\ntype input_method_service, app_api_service, system_server_service, service_manager_type;\ntype input_service, app_api_service, system_server_service, service_manager_type;\ntype imms_service, app_api_service, system_server_service, service_manager_type;\ntype jobscheduler_service, app_api_service, system_server_service, service_manager_type;\ntype launcherapps_service, app_api_service, system_server_service, service_manager_type;\ntype location_service, app_api_service, system_server_service, service_manager_type;\ntype lock_settings_service, system_api_service, system_server_service, service_manager_type;\ntype media_projection_service, app_api_service, system_server_service, service_manager_type;\ntype media_router_service, app_api_service, system_server_service, service_manager_type;\ntype media_session_service, app_api_service, system_server_service, service_manager_type;\ntype meminfo_service, system_api_service, system_server_service, service_manager_type;\ntype midi_service, app_api_service, system_server_service, service_manager_type;\ntype mount_service, app_api_service, system_server_service, service_manager_type;\ntype netpolicy_service, app_api_service, system_server_service, service_manager_type;\ntype netstats_service, system_api_service, system_server_service, service_manager_type;\ntype network_management_service, system_api_service, system_server_service, service_manager_type;\ntype network_score_service, system_api_service, system_server_service, service_manager_type;\ntype notification_service, app_api_service, system_server_service, service_manager_type;\ntype package_service, app_api_service, system_server_service, service_manager_type;\ntype permission_service, app_api_service, system_server_service, service_manager_type;\ntype persistent_data_block_service, system_api_service, system_server_service, service_manager_type;\ntype power_service, app_api_service, system_server_service, service_manager_type;\ntype print_service, app_api_service, system_server_service, service_manager_type;\ntype processinfo_service, system_server_service, service_manager_type;\ntype procstats_service, app_api_service, system_server_service, service_manager_type;\ntype registry_service, app_api_service, system_server_service, service_manager_type;\ntype restrictions_service, app_api_service, system_server_service, service_manager_type;\ntype rttmanager_service, app_api_service, system_server_service, service_manager_type;\ntype samplingprofiler_service, system_server_service, service_manager_type;\ntype scheduling_policy_service, system_server_service, service_manager_type;\ntype search_service, app_api_service, system_server_service, service_manager_type;\ntype sensorservice_service, app_api_service, system_server_service, service_manager_type;\ntype serial_service, system_api_service, system_server_service, service_manager_type;\ntype servicediscovery_service, app_api_service, system_server_service, service_manager_type;\ntype statusbar_service, app_api_service, system_server_service, service_manager_type;\ntype task_service, system_server_service, service_manager_type;\ntype textservices_service, app_api_service, system_server_service, service_manager_type;\ntype telecom_service, app_api_service, system_server_service, service_manager_type;\ntype trust_service, system_api_service, system_server_service, service_manager_type;\ntype tv_input_service, app_api_service, system_server_service, service_manager_type;\ntype uimode_service, app_api_service, system_server_service, service_manager_type;\ntype updatelock_service, system_api_service, system_server_service, service_manager_type;\ntype usagestats_service, app_api_service, system_server_service, service_manager_type;\ntype usb_service, app_api_service, system_server_service, service_manager_type;\ntype user_service, app_api_service, system_server_service, service_manager_type;\ntype vibrator_service, app_api_service, system_server_service, service_manager_type;\ntype voiceinteraction_service, app_api_service, system_server_service, service_manager_type;\ntype wallpaper_service, app_api_service, system_server_service, service_manager_type;\ntype webviewupdate_service, system_api_service, system_server_service, service_manager_type;\ntype wifip2p_service, app_api_service, system_server_service, service_manager_type;\ntype wifiscanner_service, system_api_service, system_server_service, service_manager_type;\ntype wifi_service, app_api_service, system_server_service, service_manager_type;\ntype window_service, system_api_service, system_server_service, service_manager_type;\n\n#add by aggresss\ntype hello_service, system_api_service, system_server_service, service_manager_type;\n"
  },
  {
    "path": "Code/hello_Framework/sepolicy/service_contexts",
    "content": "accessibility                             u:object_r:accessibility_service:s0\naccount                                   u:object_r:account_service:s0\nactivity                                  u:object_r:activity_service:s0\nalarm                                     u:object_r:alarm_service:s0\nandroid.security.keystore                 u:object_r:keystore_service:s0\nandroid.service.gatekeeper.IGateKeeperService    u:object_r:gatekeeper_service:s0\nappops                                    u:object_r:appops_service:s0\nappwidget                                 u:object_r:appwidget_service:s0\nassetatlas                                u:object_r:assetatlas_service:s0\naudio                                     u:object_r:audio_service:s0\nbackup                                    u:object_r:backup_service:s0\nbatteryproperties                         u:object_r:healthd_service:s0\nbatterypropreg                            u:object_r:healthd_service:s0\nbatterystats                              u:object_r:batterystats_service:s0\nbattery                                   u:object_r:battery_service:s0\nbluetooth_manager                         u:object_r:bluetooth_manager_service:s0\nbluetooth                                 u:object_r:bluetooth_service:s0\ncarrier_config                            u:object_r:radio_service:s0\nclipboard                                 u:object_r:clipboard_service:s0\ncom.android.net.IProxyService             u:object_r:IProxyService_service:s0\ncommontime_management                     u:object_r:commontime_management_service:s0\ncommon_time.clock                        u:object_r:mediaserver_service:s0\ncommon_time.config                       u:object_r:mediaserver_service:s0\nconnectivity                              u:object_r:connectivity_service:s0\nconsumer_ir                               u:object_r:consumer_ir_service:s0\ncontent                                   u:object_r:content_service:s0\ncountry_detector                          u:object_r:country_detector_service:s0\ncpuinfo                                   u:object_r:cpuinfo_service:s0\ndbinfo                                    u:object_r:dbinfo_service:s0\ndevice_policy                             u:object_r:device_policy_service:s0\ndeviceidle                                u:object_r:deviceidle_service:s0\ndevicestoragemonitor                      u:object_r:devicestoragemonitor_service:s0\ndiskstats                                 u:object_r:diskstats_service:s0\ndisplay.qservice                          u:object_r:surfaceflinger_service:s0\ndisplay                                   u:object_r:display_service:s0\nDockObserver                              u:object_r:DockObserver_service:s0\ndreams                                    u:object_r:dreams_service:s0\ndrm.drmManager                            u:object_r:drmserver_service:s0\ndropbox                                   u:object_r:dropbox_service:s0\nethernet                                  u:object_r:ethernet_service:s0\nfingerprint                               u:object_r:fingerprint_service:s0\nandroid.hardware.fingerprint.IFingerprintDaemon u:object_r:fingerprintd_service:s0\ngfxinfo                                   u:object_r:gfxinfo_service:s0\ngraphicsstats                             u:object_r:graphicsstats_service:s0\nhardware                                  u:object_r:hardware_service:s0\nhdmi_control                              u:object_r:hdmi_control_service:s0\ninputflinger                              u:object_r:inputflinger_service:s0\ninput_method                              u:object_r:input_method_service:s0\ninput                                     u:object_r:input_service:s0\niphonesubinfo_msim                        u:object_r:radio_service:s0\niphonesubinfo2                            u:object_r:radio_service:s0\niphonesubinfo                             u:object_r:radio_service:s0\nims                                       u:object_r:radio_service:s0\nimms                                      u:object_r:imms_service:s0\nisms_msim                                 u:object_r:radio_service:s0\nisms2                                     u:object_r:radio_service:s0\nisms                                      u:object_r:radio_service:s0\nisub                                      u:object_r:radio_service:s0\njobscheduler                              u:object_r:jobscheduler_service:s0\nlauncherapps                              u:object_r:launcherapps_service:s0\nlocation                                  u:object_r:location_service:s0\nlock_settings                             u:object_r:lock_settings_service:s0\nmedia.audio_flinger                       u:object_r:mediaserver_service:s0\nmedia.audio_policy                        u:object_r:mediaserver_service:s0\nmedia.camera                              u:object_r:mediaserver_service:s0\nmedia.camera.proxy                        u:object_r:cameraproxy_service:s0\nmedia.log                                 u:object_r:mediaserver_service:s0\nmedia.player                              u:object_r:mediaserver_service:s0\nmedia.resource_manager                    u:object_r:mediaserver_service:s0\nmedia.radio                               u:object_r:mediaserver_service:s0\nmedia.sound_trigger_hw                    u:object_r:mediaserver_service:s0\nmedia_projection                          u:object_r:media_projection_service:s0\nmedia_router                              u:object_r:media_router_service:s0\nmedia_session                             u:object_r:media_session_service:s0\nmeminfo                                   u:object_r:meminfo_service:s0\nmidi                                      u:object_r:midi_service:s0\nmount                                     u:object_r:mount_service:s0\nnetpolicy                                 u:object_r:netpolicy_service:s0\nnetstats                                  u:object_r:netstats_service:s0\nnetwork_management                        u:object_r:network_management_service:s0\nnetwork_score                             u:object_r:network_score_service:s0\nnfc                                       u:object_r:nfc_service:s0\nnotification                              u:object_r:notification_service:s0\npackage                                   u:object_r:package_service:s0\npermission                                u:object_r:permission_service:s0\npersistent_data_block                     u:object_r:persistent_data_block_service:s0\nphone_msim                                u:object_r:radio_service:s0\nphone1                                    u:object_r:radio_service:s0\nphone2                                    u:object_r:radio_service:s0\nphone                                     u:object_r:radio_service:s0\npower                                     u:object_r:power_service:s0\nprint                                     u:object_r:print_service:s0\nprocessinfo                               u:object_r:processinfo_service:s0\nprocstats                                 u:object_r:procstats_service:s0\nradio.phonesubinfo                        u:object_r:radio_service:s0\nradio.phone                               u:object_r:radio_service:s0\nradio.sms                                 u:object_r:radio_service:s0\nrestrictions                              u:object_r:restrictions_service:s0\nrttmanager                                u:object_r:rttmanager_service:s0\nsamplingprofiler                          u:object_r:samplingprofiler_service:s0\nscheduling_policy                         u:object_r:scheduling_policy_service:s0\nsearch                                    u:object_r:search_service:s0\nsensorservice                             u:object_r:sensorservice_service:s0\nserial                                    u:object_r:serial_service:s0\nservicediscovery                          u:object_r:servicediscovery_service:s0\nsimphonebook_msim                         u:object_r:radio_service:s0\nsimphonebook2                             u:object_r:radio_service:s0\nsimphonebook                              u:object_r:radio_service:s0\nsip                                       u:object_r:radio_service:s0\nstatusbar                                 u:object_r:statusbar_service:s0\nSurfaceFlinger                            u:object_r:surfaceflinger_service:s0\ntask                                      u:object_r:task_service:s0\ntelecom                                   u:object_r:telecom_service:s0\ntelephony.registry                        u:object_r:registry_service:s0\ntextservices                              u:object_r:textservices_service:s0\ntrust                                     u:object_r:trust_service:s0\ntv_input                                  u:object_r:tv_input_service:s0\nuimode                                    u:object_r:uimode_service:s0\nupdatelock                                u:object_r:updatelock_service:s0\nusagestats                                u:object_r:usagestats_service:s0\nusb                                       u:object_r:usb_service:s0\nuser                                      u:object_r:user_service:s0\nvibrator                                  u:object_r:vibrator_service:s0\nvoiceinteraction                          u:object_r:voiceinteraction_service:s0\nwallpaper                                 u:object_r:wallpaper_service:s0\nwebviewupdate                             u:object_r:webviewupdate_service:s0\nwifip2p                                   u:object_r:wifip2p_service:s0\nwifiscanner                               u:object_r:wifiscanner_service:s0\nwifi                                      u:object_r:wifi_service:s0\nwindow                                    u:object_r:window_service:s0\n#add by aggresss\nhello\t\t\t\t\t  u:object_r:hello_service:s0\n*                                         u:object_r:default_android_service:s0\n"
  },
  {
    "path": "Code/hello_Framework/sepolicy/system_server.te",
    "content": "#\n# System Server aka system_server spawned by zygote.\n# Most of the framework services run in this process.\n#\ntype system_server, domain, mlstrustedsubject;\n\n# Define a type for tmpfs-backed ashmem regions.\ntmpfs_domain(system_server)\n\n# Dalvik Compiler JIT Mapping.\nallow system_server self:process execmem;\nallow system_server ashmem_device:chr_file execute;\nallow system_server system_server_tmpfs:file execute;\n\n# For art.\nallow system_server dalvikcache_data_file:file execute;\nallow system_server dalvikcache_data_file:dir r_dir_perms;\n\n# /data/resource-cache\nallow system_server resourcecache_data_file:file r_file_perms;\nallow system_server resourcecache_data_file:dir r_dir_perms;\n\n# ptrace to processes in the same domain for debugging crashes.\nallow system_server self:process ptrace;\n\n# Child of the zygote.\nallow system_server zygote:fd use;\nallow system_server zygote:process sigchld;\nallow system_server zygote_tmpfs:file read;\n\n# May kill zygote on crashes.\nallow system_server zygote:process sigkill;\n\n# Read /system/bin/app_process.\nallow system_server zygote_exec:file r_file_perms;\n\n# Needed to close the zygote socket, which involves getopt / getattr\nallow system_server zygote:unix_stream_socket { getopt getattr };\n\n# system server gets network and bluetooth permissions.\nnet_domain(system_server)\nbluetooth_domain(system_server)\n\n# These are the capabilities assigned by the zygote to the\n# system server.\nallow system_server self:capability {\n    kill\n    net_admin\n    net_bind_service\n    net_broadcast\n    net_raw\n    sys_boot\n    sys_nice\n    sys_resource\n    sys_time\n    sys_tty_config\n};\n\nwakelock_use(system_server)\n\n# Triggered by /proc/pid accesses, not allowed.\ndontaudit system_server self:capability sys_ptrace;\n\n# Trigger module auto-load.\nallow system_server kernel:system module_request;\n\n# Use netlink uevent sockets.\nallow system_server self:netlink_kobject_uevent_socket create_socket_perms;\n\n# Use generic netlink sockets.\nallow system_server self:netlink_socket create_socket_perms;\n\n# Set and get routes directly via netlink.\nallow system_server self:netlink_route_socket nlmsg_write;\n\n# Kill apps.\nallow system_server appdomain:process { sigkill signal };\n\n# Set scheduling info for apps.\nallow system_server appdomain:process { getsched setsched };\nallow system_server mediaserver:process { getsched setsched };\n\n# Read /proc/pid data for all domains. This is used by ProcessCpuTracker\n# within system_server to keep track of memory and CPU usage for\n# all processes on the device.\nr_dir_file(system_server, domain)\n\n# Read/Write to /proc/net/xt_qtaguid/ctrl and and /dev/xt_qtaguid.\nallow system_server qtaguid_proc:file rw_file_perms;\nallow system_server qtaguid_device:chr_file rw_file_perms;\n\n# Read /proc/uid_cputime/show_uid_stat.\nallow system_server proc_uid_cputime_showstat:file r_file_perms;\n\n# Write /proc/uid_cputime/remove_uid_range.\nallow system_server proc_uid_cputime_removeuid:file { w_file_perms getattr };\n\n# Write to /proc/sysrq-trigger.\nallow system_server proc_sysrq:file rw_file_perms;\n\n# Read /sys/kernel/debug/wakeup_sources.\nallow system_server debugfs:file r_file_perms;\n\n# The DhcpClient and WifiWatchdog use packet_sockets\nallow system_server self:packet_socket create_socket_perms;\n\n# NetworkDiagnostics requires explicit bind() calls to ping sockets. These aren't actually the same\n# as raw sockets, but the kernel doesn't yet distinguish between the two.\nallow system_server node:rawip_socket node_bind;\n\n# 3rd party VPN clients require a tun_socket to be created\nallow system_server self:tun_socket create_socket_perms;\n\n# Notify init of death.\nallow system_server init:process sigchld;\n\n# Talk to init and various daemons via sockets.\nunix_socket_connect(system_server, installd, installd)\nunix_socket_connect(system_server, lmkd, lmkd)\nunix_socket_connect(system_server, mtpd, mtp)\nunix_socket_connect(system_server, netd, netd)\nunix_socket_connect(system_server, vold, vold)\nunix_socket_connect(system_server, zygote, zygote)\nunix_socket_connect(system_server, gps, gpsd)\nunix_socket_connect(system_server, racoon, racoon)\nunix_socket_send(system_server, wpa, wpa)\n\n# Communicate over a socket created by surfaceflinger.\nallow system_server surfaceflinger:unix_stream_socket { read write setopt };\n\n# Perform Binder IPC.\nbinder_use(system_server)\nbinder_call(system_server, binderservicedomain)\nbinder_call(system_server, gatekeeperd)\nbinder_call(system_server, fingerprintd)\nbinder_call(system_server, appdomain)\nbinder_call(system_server, dumpstate)\nbinder_service(system_server)\n\n# Ask debuggerd to dump backtraces for native stacks of interest.\nallow system_server { mediaserver sdcardd surfaceflinger inputflinger }:debuggerd dump_backtrace;\n\n# Read /proc/pid files for dumping stack traces of native processes.\nr_dir_file(system_server, mediaserver)\nr_dir_file(system_server, sdcardd)\nr_dir_file(system_server, surfaceflinger)\nr_dir_file(system_server, inputflinger)\n\n# Use sockets received over binder from various services.\nallow system_server mediaserver:tcp_socket rw_socket_perms;\nallow system_server mediaserver:udp_socket rw_socket_perms;\n\n# Check SELinux permissions.\nselinux_check_access(system_server)\n\n# XXX Label sysfs files with a specific type?\nallow system_server sysfs:file rw_file_perms;\nallow system_server sysfs_nfc_power_writable:file rw_file_perms;\nallow system_server sysfs_devices_system_cpu:file w_file_perms;\n\n# Access devices.\nallow system_server device:dir r_dir_perms;\nallow system_server mdns_socket:sock_file rw_file_perms;\nallow system_server alarm_device:chr_file rw_file_perms;\nallow system_server gpu_device:chr_file rw_file_perms;\nallow system_server iio_device:chr_file rw_file_perms;\nallow system_server input_device:dir r_dir_perms;\nallow system_server input_device:chr_file rw_file_perms;\nallow system_server radio_device:chr_file r_file_perms;\nallow system_server tty_device:chr_file rw_file_perms;\nallow system_server usbaccessory_device:chr_file rw_file_perms;\nallow system_server video_device:dir r_dir_perms;\nallow system_server video_device:chr_file rw_file_perms;\nallow system_server adbd_socket:sock_file rw_file_perms;\nallow system_server rtc_device:chr_file rw_file_perms;\nallow system_server audio_device:dir r_dir_perms;\n\n# write access needed for MIDI\nallow system_server audio_device:chr_file rw_file_perms;\n\n# tun device used for 3rd party vpn apps\nallow system_server tun_device:chr_file rw_file_perms;\n\n# Manage system data files.\nallow system_server system_data_file:dir create_dir_perms;\nallow system_server system_data_file:notdevfile_class_set create_file_perms;\nallow system_server keychain_data_file:dir create_dir_perms;\nallow system_server keychain_data_file:file create_file_perms;\n\n# Manage /data/app.\nallow system_server apk_data_file:dir create_dir_perms;\nallow system_server apk_data_file:file { create_file_perms link };\nallow system_server apk_tmp_file:dir create_dir_perms;\nallow system_server apk_tmp_file:file create_file_perms;\n\n# Manage /data/app-private.\nallow system_server apk_private_data_file:dir create_dir_perms;\nallow system_server apk_private_data_file:file create_file_perms;\nallow system_server apk_private_tmp_file:dir create_dir_perms;\nallow system_server apk_private_tmp_file:file create_file_perms;\n\n# Manage files within asec containers.\nallow system_server asec_apk_file:dir create_dir_perms;\nallow system_server asec_apk_file:file create_file_perms;\nallow system_server asec_public_file:file create_file_perms;\n\n# Manage /data/anr.\nallow system_server anr_data_file:dir create_dir_perms;\nallow system_server anr_data_file:file create_file_perms;\n\n# Manage /data/backup.\nallow system_server backup_data_file:dir create_dir_perms;\nallow system_server backup_data_file:file create_file_perms;\n\n# Read from /data/dalvik-cache/profiles\nallow system_server dalvikcache_profiles_data_file:dir rw_dir_perms;\nallow system_server dalvikcache_profiles_data_file:file create_file_perms;\n\n# Write to /data/system/heapdump\nallow system_server heapdump_data_file:dir rw_dir_perms;\nallow system_server heapdump_data_file:file create_file_perms;\n\n# Manage /data/misc/adb.\nallow system_server adb_keys_file:dir create_dir_perms;\nallow system_server adb_keys_file:file create_file_perms;\n\n# Manage /data/misc/sms.\n# TODO:  Split into a separate type?\nallow system_server radio_data_file:dir create_dir_perms;\nallow system_server radio_data_file:file create_file_perms;\n\n# Manage /data/misc/systemkeys.\nallow system_server systemkeys_data_file:dir create_dir_perms;\nallow system_server systemkeys_data_file:file create_file_perms;\n\n# Access /data/tombstones.\nallow system_server tombstone_data_file:dir r_dir_perms;\nallow system_server tombstone_data_file:file r_file_perms;\n\n# Manage /data/misc/vpn.\nallow system_server vpn_data_file:dir create_dir_perms;\nallow system_server vpn_data_file:file create_file_perms;\n\n# Manage /data/misc/wifi.\nallow system_server wifi_data_file:dir create_dir_perms;\nallow system_server wifi_data_file:file create_file_perms;\n\n# Manage /data/misc/zoneinfo.\nallow system_server zoneinfo_data_file:dir create_dir_perms;\nallow system_server zoneinfo_data_file:file create_file_perms;\n\n# Walk /data/data subdirectories.\n# Types extracted from seapp_contexts type= fields.\nallow system_server { system_app_data_file bluetooth_data_file nfc_data_file radio_data_file shell_data_file app_data_file }:dir { getattr read search };\n# Also permit for unlabeled /data/data subdirectories and\n# for unlabeled asec containers on upgrades from 4.2.\nallow system_server unlabeled:dir r_dir_perms;\n# Read pkg.apk file before it has been relabeled by vold.\nallow system_server unlabeled:file r_file_perms;\n\n# Populate com.android.providers.settings/databases/settings.db.\nallow system_server system_app_data_file:dir create_dir_perms;\nallow system_server system_app_data_file:file create_file_perms;\n\n# Receive and use open app data files passed over binder IPC.\n# Types extracted from seapp_contexts type= fields.\nallow system_server { system_app_data_file bluetooth_data_file nfc_data_file radio_data_file shell_data_file app_data_file }:file { getattr read write };\n\n# Receive and use open /data/media files passed over binder IPC.\nallow system_server media_rw_data_file:file { getattr read write };\n\n# Read /file_contexts and /data/security/file_contexts\nsecurity_access_policy(system_server)\n\n# Relabel apk files.\nallow system_server { apk_tmp_file apk_private_tmp_file }:{ dir file } { relabelfrom relabelto };\nallow system_server { apk_data_file apk_private_data_file }:{ dir file } { relabelfrom relabelto };\n\n# Relabel wallpaper.\nallow system_server system_data_file:file relabelfrom;\nallow system_server wallpaper_file:file relabelto;\nallow system_server wallpaper_file:file { rw_file_perms unlink };\n\n# Relabel /data/anr.\nallow system_server system_data_file:dir relabelfrom;\nallow system_server anr_data_file:dir relabelto;\n\n# Property Service write\nset_prop(system_server, system_prop)\nset_prop(system_server, dhcp_prop)\nset_prop(system_server, net_radio_prop)\nset_prop(system_server, system_radio_prop)\nset_prop(system_server, debug_prop)\nset_prop(system_server, powerctl_prop)\nset_prop(system_server, fingerprint_prop)\n\n# ctl interface\nset_prop(system_server, ctl_default_prop)\nset_prop(system_server, ctl_dhcp_pan_prop)\nset_prop(system_server, ctl_bugreport_prop)\n\n# Create a socket for receiving info from wpa.\ntype_transition system_server wifi_data_file:sock_file system_wpa_socket;\ntype_transition system_server wpa_socket:sock_file system_wpa_socket;\nallow system_server wpa_socket:dir rw_dir_perms;\nallow system_server system_wpa_socket:sock_file create_file_perms;\n\n# Remove sockets created by wpa_supplicant\nallow system_server wpa_socket:sock_file unlink;\n\n# Create a socket for connections from debuggerd.\ntype_transition system_server system_data_file:sock_file system_ndebug_socket \"ndebugsocket\";\nallow system_server system_ndebug_socket:sock_file create_file_perms;\n\n# Manage cache files.\nallow system_server cache_file:dir { relabelfrom create_dir_perms };\nallow system_server cache_file:file { relabelfrom create_file_perms };\nallow system_server cache_file:fifo_file create_file_perms;\n\n# Run system programs, e.g. dexopt.\nallow system_server system_file:file x_file_perms;\n\n# LocationManager(e.g, GPS) needs to read and write\n# to uart driver and ctrl proc entry\nallow system_server gps_device:chr_file rw_file_perms;\nallow system_server gps_control:file rw_file_perms;\n\n# Allow system_server to use app-created sockets and pipes.\nallow system_server appdomain:{ tcp_socket udp_socket } { getattr getopt setopt read write shutdown };\nallow system_server appdomain:{ fifo_file unix_stream_socket } { getattr read write };\n\n# Allow abstract socket connection\nallow system_server rild:unix_stream_socket connectto;\n\n# BackupManagerService lets PMS create a data backup file\nallow system_server cache_backup_file:file create_file_perms;\n# Relabel /data/backup\nallow system_server backup_data_file:dir { relabelto relabelfrom };\n# Relabel /cache/.*\\.{data|restore}\nallow system_server cache_backup_file:file { relabelto relabelfrom };\n# LocalTransport creates and relabels /cache/backup\nallow system_server cache_backup_file:dir { relabelto relabelfrom create_dir_perms };\n\n# Allow system to talk to usb device\nallow system_server usb_device:chr_file rw_file_perms;\nallow system_server usb_device:dir r_dir_perms;\n\n# Allow system to talk to sensors\nallow system_server sensors_device:chr_file rw_file_perms;\n\n# Read from HW RNG (needed by EntropyMixer).\nallow system_server hw_random_device:chr_file r_file_perms;\n\n# Read and delete files under /dev/fscklogs.\nr_dir_file(system_server, fscklogs)\nallow system_server fscklogs:dir { write remove_name };\nallow system_server fscklogs:file unlink;\n\n# For SELinuxPolicyInstallReceiver\nselinux_manage_policy(system_server)\n\n# logd access, system_server inherit logd write socket\n# (urge is to deprecate this long term)\nallow system_server zygote:unix_dgram_socket write;\n\n# Read from log daemon.\nread_logd(system_server)\n\n# Be consistent with DAC permissions. Allow system_server to write to\n# /sys/module/lowmemorykiller/parameters/adj\n# /sys/module/lowmemorykiller/parameters/minfree\nallow system_server sysfs_lowmemorykiller:file { getattr w_file_perms };\n\n# Read /sys/fs/pstore/console-ramoops\n# Don't worry about overly broad permissions for now, as there's\n# only one file in /sys/fs/pstore\nallow system_server pstorefs:dir r_dir_perms;\nallow system_server pstorefs:file r_file_perms;\n\nallow system_server drmserver_service:service_manager find;\nallow system_server healthd_service:service_manager find;\nallow system_server keystore_service:service_manager find;\nallow system_server gatekeeper_service:service_manager find;\nallow system_server fingerprintd_service:service_manager find;\nallow system_server mediaserver_service:service_manager find;\nallow system_server nfc_service:service_manager find;\nallow system_server radio_service:service_manager find;\nallow system_server system_server_service:service_manager { add find };\nallow system_server surfaceflinger_service:service_manager find;\n\nallow system_server keystore:keystore_key {\n\tget_state\n\tget\n\tinsert\n\tdelete\n\texist\n\tlist\n\treset\n\tpassword\n\tlock\n\tunlock\n\tis_empty\n\tsign\n\tverify\n\tgrant\n\tduplicate\n\tclear_uid\n\tadd_auth\n\tuser_changed\n};\n\n# Allow system server to search and write to the persistent factory reset\n# protection partition. This block device does not get wiped in a factory reset.\nallow system_server block_device:dir search;\nallow system_server frp_block_device:blk_file rw_file_perms;\n\n# Clean up old cgroups\nallow system_server cgroup:dir { remove_name rmdir };\n\n# /oem access\nr_dir_file(system_server, oemfs)\n\n# Allow resolving per-user storage symlinks\nallow system_server { mnt_user_file storage_file }:dir { getattr search };\nallow system_server { mnt_user_file storage_file }:lnk_file { getattr read };\n\n# Allow statfs() on storage devices, which happens fast enough that\n# we shouldn't be killed during unsafe removal\nallow system_server sdcard_type:dir { getattr search };\n\n# Traverse into expanded storage\nallow system_server mnt_expand_file:dir r_dir_perms;\n\n# Allow system process to relabel the fingerprint directory after mkdir\nallow system_server fingerprintd_data_file:dir {r_dir_perms relabelto};\n\n###\n### Neverallow rules\n###\n### system_server should NEVER do any of this\n\n# Do not allow opening files from external storage as unsafe ejection\n# could cause the kernel to kill the system_server.\nneverallow system_server sdcard_type:dir { open read write };\nneverallow system_server sdcard_type:file rw_file_perms;\n\n# system server should never be opening zygote spawned app data\n# files directly. Rather, they should always be passed via a\n# file descriptor.\n# Types extracted from seapp_contexts type= fields, excluding\n# those types that system_server needs to open directly.\nneverallow system_server { bluetooth_data_file nfc_data_file shell_data_file app_data_file }:file open;\n\n# system_server should never be executing dex2oat. This is either\n# a bug (for example, bug 16317188), or represents an attempt by\n# system server to dynamically load a dex file, something we do not\n# want to allow.\nneverallow system_server dex2oat_exec:file no_x_file_perms;\n\n# The only block device system_server should be accessing is\n# the frp_block_device. This helps avoid a system_server to root\n# escalation by writing to raw block devices.\nneverallow system_server { dev_type -frp_block_device }:blk_file no_rw_file_perms;\n\n#add by aggresss\nallow system_server hello_device:chr_file rw_file_perms;\n"
  },
  {
    "path": "Code/hello_HAL/Android.mk",
    "content": "LOCAL_PATH := $(call my-dir)\n\tinclude $(CLEAR_VARS)\n\tLOCAL_MODULE_TAGS := optional\n\tLOCAL_PRELINK_MODULE := false\n\tLOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/hw\n\tLOCAL_SHARED_LIBRARIES := liblog\n\tLOCAL_SRC_FILES := hello.c\n\tLOCAL_MODULE := hello.default\n\tinclude $(BUILD_SHARED_LIBRARY)\n"
  },
  {
    "path": "Code/hello_HAL/hello.c",
    "content": "#define LOG_TAG \"HelloStub\"  \n  \n#include <hardware/hardware.h>  \n#include <hardware/hello.h>  \n#include <fcntl.h>  \n#include <errno.h>  \n#include <cutils/log.h>  \n#include <cutils/atomic.h>  \n  \n#define DEVICE_NAME \"/dev/hello\"  \n#define MODULE_NAME \"Hello\"  \n#define MODULE_AUTHOR \"shyluo@gmail.com\"  \n  \n/*设备打开和关闭接口*/  \nstatic int hello_device_open(const struct hw_module_t* module, const char* name, struct hw_device_t** device);  \nstatic int hello_device_close(struct hw_device_t* device);  \n  \n/*设备访问接口*/  \nstatic int hello_set_val(struct hello_device_t* dev, int val);  \nstatic int hello_get_val(struct hello_device_t* dev, int* val);  \n  \n/*模块方法表*/  \nstatic struct hw_module_methods_t hello_module_methods = {  \n    open: hello_device_open  \n};  \n  \n/*模块实例变量*/  \nstruct hello_module_t HAL_MODULE_INFO_SYM = {  \n    common: {  \n        tag: HARDWARE_MODULE_TAG,  \n        version_major: 1,  \n        version_minor: 0,  \n        id: HELLO_HARDWARE_MODULE_ID,  \n        name: MODULE_NAME,  \n        author: MODULE_AUTHOR,  \n        methods: &hello_module_methods,  \n    }  \n};  \n\n\nstatic int hello_device_open(const struct hw_module_t* module, const char* name, struct hw_device_t** device) {  \n    struct hello_device_t* dev;dev = (struct hello_device_t*)malloc(sizeof(struct hello_device_t));  \n      \n    if(!dev) {  \n        ALOGE(\"Hello Stub: failed to alloc space\");  \n        return -EFAULT;  \n    }  \n  \n    memset(dev, 0, sizeof(struct hello_device_t));  \n    dev->common.tag = HARDWARE_DEVICE_TAG;  \n    dev->common.version = 0;  \n    dev->common.module = (hw_module_t*)module;  \n    dev->common.close = hello_device_close;  \n    dev->set_val = hello_set_val;dev->get_val = hello_get_val;  \n  \n    if((dev->fd = open(DEVICE_NAME, O_RDWR)) == -1) {  \n        ALOGE(\"Hello Stub: failed to open /dev/hello -- %s.\", strerror(errno));free(dev);  \n        return -EFAULT;  \n    }  \n  \n    *device = &(dev->common);  \n    ALOGI(\"Hello Stub: open /dev/hello successfully.\");  \n  \n    return 0;  \n}  \n\nstatic int hello_device_close(struct hw_device_t* device) {  \n    struct hello_device_t* hello_device = (struct hello_device_t*)device;  \n  \n    if(hello_device) {  \n        close(hello_device->fd);  \n        free(hello_device);  \n    }  \n      \n    return 0;  \n}  \n  \nstatic int hello_set_val(struct hello_device_t* dev, int val) {  \n    ALOGI(\"Hello Stub: set value %d to device.\", val);  \n  \n    write(dev->fd, &val, sizeof(val));  \n  \n    return 0;  \n}  \n  \nstatic int hello_get_val(struct hello_device_t* dev, int* val) {  \n    if(!val) {  \n        ALOGE(\"Hello Stub: error val pointer\");  \n        return -EFAULT;  \n    }  \n  \n    read(dev->fd, val, sizeof(*val));  \n  \n    ALOGI(\"Hello Stub: get value %d from device\", *val);  \n  \n    return 0;  \n}  \n"
  },
  {
    "path": "Code/hello_HAL/hello.h",
    "content": " #ifndef ANDROID_HELLO_INTERFACE_H  \n#define ANDROID_HELLO_INTERFACE_H  \n#include <hardware/hardware.h>  \n  \n__BEGIN_DECLS  \n  \n/*定义模块ID*/  \n#define HELLO_HARDWARE_MODULE_ID \"hello\"  \n  \n/*硬件模块结构体*/  \nstruct hello_module_t {  \n    struct hw_module_t common;  \n};  \n  \n/*硬件接口结构体*/  \nstruct hello_device_t {  \n    struct hw_device_t common;  \n    int fd;  \n    int (*set_val)(struct hello_device_t* dev, int val);  \n    int (*get_val)(struct hello_device_t* dev, int* val);  \n};  \n  \n__END_DECLS  \n  \n#endif  \n"
  },
  {
    "path": "Code/hello_JNI/com_android_server_HelloService.cpp",
    "content": "#define LOG_TAG \"HelloService\"  \n#include \"jni.h\"  \n#include \"JNIHelp.h\"  \n#include \"android_runtime/AndroidRuntime.h\"  \n#include <utils/misc.h>  \n#include <utils/Log.h>  \n#include <hardware/hardware.h>  \n#include <hardware/hello.h>  \n#include <stdio.h>  \n\nnamespace android  \n{  \n    /*在硬件抽象层中定义的硬件访问结构体，参考<hardware/hello.h>*/  \n        struct hello_device_t* hello_device = NULL;  \n    /*通过硬件抽象层定义的硬件访问接口设置硬件寄存器val的值*/  \n        static void hello_setVal(JNIEnv* env, jobject clazz, jint value) {  \n        int val = value;  \n        ALOGI(\"Hello JNI: set value %d to device.\", val);  \n        if(!hello_device) {  \n            ALOGI(\"Hello JNI: device is not open.\");  \n            return;  \n        }  \n          \n        hello_device->set_val(hello_device, val);  \n    }  \n        /*通过硬件抽象层定义的硬件访问接口读取硬件寄存器val的值*/  \n    static jint hello_getVal(JNIEnv* env, jobject clazz) {  \n        int val = 0;  \n        if(!hello_device) {  \n            ALOGI(\"Hello JNI: device is not open.\");  \n            return val;  \n        }  \n        hello_device->get_val(hello_device, &val);  \n          \n        ALOGI(\"Hello JNI: get value %d from device.\", val);  \n      \n        return val;  \n    }  \n        /*通过硬件抽象层定义的硬件模块打开接口打开硬件设备*/  \n    static inline int hello_device_open(const hw_module_t* module, struct hello_device_t** device) {  \n        return module->methods->open(module, HELLO_HARDWARE_MODULE_ID, (struct hw_device_t**)device);  \n    }  \n        /*通过硬件模块ID来加载指定的硬件抽象层模块并打开硬件*/  \n    static jboolean hello_init(JNIEnv* env, jclass clazz) {  \n        hello_module_t* module;  \n          \n        ALOGI(\"Hello JNI: initializing......\");  \n        if(hw_get_module(HELLO_HARDWARE_MODULE_ID, (const struct hw_module_t**)&module) == 0) {  \n            ALOGI(\"Hello JNI: hello Stub found.\");  \n            if(hello_device_open(&(module->common), &hello_device) == 0) {  \n                ALOGI(\"Hello JNI: hello device is open.\");  \n                return 0;  \n            }  \n            ALOGE(\"Hello JNI: failed to open hello device.\");  \n            return -1;  \n        }  \n        ALOGE(\"Hello JNI: failed to get hello stub module.\");  \n        return -1;        \n    }  \n        /*JNI方法表*/  \n    static const JNINativeMethod method_table[] = {  \n        {\"init_native\", \"()Z\", (void*)hello_init},  \n        {\"setVal_native\", \"(I)V\", (void*)hello_setVal},  \n        {\"getVal_native\", \"()I\", (void*)hello_getVal},  \n    };  \n        /*注册JNI方法*/  \n    int register_android_server_HelloService(JNIEnv *env) {  \n            return jniRegisterNativeMethods(env, \"com/android/server/HelloService\", method_table, NELEM(method_table));  \n    }  \n};  \n"
  },
  {
    "path": "Code/hello_KernelDriver/Kconfig",
    "content": " config HELLO\n           tristate \"First Android Driver\"\n           default n\n           help\n           This is the first android driver.\n"
  },
  {
    "path": "Code/hello_KernelDriver/Makefile",
    "content": "obj-$(CONFIG_HELLO) += hello.o\n"
  },
  {
    "path": "Code/hello_KernelDriver/hello.c",
    "content": "/*******************************************\n*include file and define functions\n*******************************************/\n#include <linux/init.h>  \n#include <linux/module.h>  \n#include <linux/types.h>  \n#include <linux/fs.h>  \n#include <linux/proc_fs.h>  \n#include <linux/device.h>  \n#include <asm/uaccess.h>  \n  \n#include \"hello.h\"  \n  \n/*主设备和从设备号变量*/  \nstatic int hello_major = 0;  \nstatic int hello_minor = 0;  \n  \n/*设备类别和设备变量*/  \nstatic struct class* hello_class = NULL;  \nstatic struct hello_android_dev* hello_dev = NULL;  \n  \n/*传统的设备文件操作方法*/  \nstatic int hello_open(struct inode* inode, struct file* filp);  \nstatic int hello_release(struct inode* inode, struct file* filp);  \nstatic ssize_t hello_read(struct file* filp, char __user *buf, size_t count, loff_t* f_pos);  \nstatic ssize_t hello_write(struct file* filp, const char __user *buf, size_t count, loff_t* f_pos);  \n  \n/*设备文件操作方法表*/  \nstatic struct file_operations hello_fops = {  \n    .owner = THIS_MODULE,  \n    .open = hello_open,  \n    .release = hello_release,  \n    .read = hello_read,  \n    .write = hello_write,   \n};  \n  \n/*访问设置属性方法*/  \nstatic ssize_t hello_val_show(struct device* dev, struct device_attribute* attr,  char* buf);  \nstatic ssize_t hello_val_store(struct device* dev, struct device_attribute* attr, const char* buf, size_t count);  \n  \n/*定义设备属性*/  \nstatic DEVICE_ATTR(val, S_IRUGO | S_IWUSR, hello_val_show, hello_val_store);\n\n/*******************************************\n*define traditional file access \n*******************************************/\n/*打开设备方法*/  \nstatic int hello_open(struct inode* inode, struct file* filp) {  \n    struct hello_android_dev* dev;          \n      \n    /*将自定义设备结构体保存在文件指针的私有数据域中，以便访问设备时拿来用*/  \n    dev = container_of(inode->i_cdev, struct hello_android_dev, dev);  \n    filp->private_data = dev;  \n      \n    return 0;  \n}  \n  \n/*设备文件释放时调用，空实现*/  \nstatic int hello_release(struct inode* inode, struct file* filp) {  \n    return 0;  \n}  \n  \n/*读取设备的寄存器val的值*/  \nstatic ssize_t hello_read(struct file* filp, char __user *buf, size_t count, loff_t* f_pos) {  \n    ssize_t err = 0;  \n    struct hello_android_dev* dev = filp->private_data;          \n  \n    /*同步访问*/  \n    if(down_interruptible(&(dev->sem))) {  \n        return -ERESTARTSYS;  \n    }  \n  \n    if(count < sizeof(dev->val)) {  \n        goto out;  \n    }          \n  \n    /*将寄存器val的值拷贝到用户提供的缓冲区*/  \n    if(copy_to_user(buf, &(dev->val), sizeof(dev->val))) {  \n        err = -EFAULT;  \n        goto out;  \n    }  \n  \n    err = sizeof(dev->val);  \n  \nout:  \n    up(&(dev->sem));  \n    return err;  \n}  \n  \n/*写设备的寄存器值val*/  \nstatic ssize_t hello_write(struct file* filp, const char __user *buf, size_t count, loff_t* f_pos) {  \n    struct hello_android_dev* dev = filp->private_data;  \n    ssize_t err = 0;          \n  \n    /*同步访问*/  \n    if(down_interruptible(&(dev->sem))) {  \n        return -ERESTARTSYS;          \n    }          \n  \n    if(count != sizeof(dev->val)) {  \n        goto out;          \n    }          \n  \n    /*将用户提供的缓冲区的值写到设备寄存器去*/  \n    if(copy_from_user(&(dev->val), buf, count)) {  \n        err = -EFAULT;  \n        goto out;  \n    }  \n  \n    err = sizeof(dev->val);  \n  \nout:  \n    up(&(dev->sem));  \n    return err;  \n}  \n\n/*******************************************\n*define devfs access\n*******************************************/\n/*读取寄存器val的值到缓冲区buf中，内部使用*/  \nstatic ssize_t __hello_get_val(struct hello_android_dev* dev, char* buf) {  \n    int val = 0;          \n  \n    /*同步访问*/  \n    if(down_interruptible(&(dev->sem))) {                  \n        return -ERESTARTSYS;          \n    }          \n  \n    val = dev->val;          \n    up(&(dev->sem));          \n  \n    return snprintf(buf, PAGE_SIZE, \"%d\\n\", val);  \n}  \n  \n/*把缓冲区buf的值写到设备寄存器val中去，内部使用*/  \nstatic ssize_t __hello_set_val(struct hello_android_dev* dev, const char* buf, size_t count) {  \n    int val = 0;          \n  \n    /*将字符串转换成数字*/          \n    val = simple_strtol(buf, NULL, 10);          \n  \n    /*同步访问*/          \n    if(down_interruptible(&(dev->sem))) {                  \n        return -ERESTARTSYS;          \n    }          \n  \n    dev->val = val;          \n    up(&(dev->sem));  \n  \n    return count;  \n}  \n  \n/*读取设备属性val*/  \nstatic ssize_t hello_val_show(struct device* dev, struct device_attribute* attr, char* buf) {  \n    struct hello_android_dev* hdev = (struct hello_android_dev*)dev_get_drvdata(dev);          \n  \n    return __hello_get_val(hdev, buf);  \n}  \n  \n/*写设备属性val*/  \nstatic ssize_t hello_val_store(struct device* dev, struct device_attribute* attr, const char* buf, size_t count) {   \n    struct hello_android_dev* hdev = (struct hello_android_dev*)dev_get_drvdata(dev);    \n      \n    return __hello_set_val(hdev, buf, count);  \n}  \n\n/*******************************************\n*define proc access\n*******************************************/\n/*读取设备寄存器val的值，保存在page缓冲区中*/  \nstatic ssize_t hello_proc_read(char* page, char** start, off_t off, int count, int* eof, void* data) {  \n    if(off > 0) {  \n        *eof = 1;  \n        return 0;  \n    }  \n  \n    return __hello_get_val(hello_dev, page);  \n}  \n  \n/*把缓冲区的值buff保存到设备寄存器val中去*/  \nstatic ssize_t hello_proc_write(struct file* filp, const char __user *buff, unsigned long len, void* data) {  \n    int err = 0;  \n    char* page = NULL;  \n  \n    if(len > PAGE_SIZE) {  \n        printk(KERN_ALERT\"The buff is too large: %lu.\\n\", len);  \n        return -EFAULT;  \n    }  \n  \n    page = (char*)__get_free_page(GFP_KERNEL);  \n    if(!page) {                  \n        printk(KERN_ALERT\"Failed to alloc page.\\n\");  \n        return -ENOMEM;  \n    }          \n  \n    /*先把用户提供的缓冲区值拷贝到内核缓冲区中去*/  \n    if(copy_from_user(page, buff, len)) {  \n        printk(KERN_ALERT\"Failed to copy buff from user.\\n\");                  \n        err = -EFAULT;  \n        goto out;  \n    }  \n  \n    err = __hello_set_val(hello_dev, page, len);  \n  \nout:  \n    free_page((unsigned long)page);  \n    return err;  \n}  \n  \n/*创建/proc/hello文件*/  \nstatic void hello_create_proc(void) {\n\tstruct proc_dir_entry *entry;\n\tentry = create_proc_entry(HELLO_DEVICE_PROC_NAME, 0, NULL);\n\tif(entry)\n\t{\n\t\tentry->read_proc = hello_proc_read;\n\t\tentry->write_proc = hello_proc_write;\n\t}\n}  \n  \n/*删除/proc/hello文件*/  \nstatic void hello_remove_proc(void) {  \n    remove_proc_entry(HELLO_DEVICE_PROC_NAME, NULL);  \n}  \n\n/*******************************************\n*define load and remove function\n*******************************************/\n/*初始化设备*/  \nstatic int  __hello_setup_dev(struct hello_android_dev* dev) {  \n    int err;  \n    dev_t devno = MKDEV(hello_major, hello_minor);  \n  \n    memset(dev, 0, sizeof(struct hello_android_dev));  \n  \n    cdev_init(&(dev->dev), &hello_fops);  \n    dev->dev.owner = THIS_MODULE;  \n    dev->dev.ops = &hello_fops;          \n  \n    /*注册字符设备*/  \n    err = cdev_add(&(dev->dev),devno, 1);  \n    if(err) {  \n        return err;  \n    }          \n  \n    /*初始化信号量和寄存器val的值*/  \n    sema_init(&(dev->sem), 1);  \n    dev->val = 0;  \n  \n    return 0;  \n}  \n  \n/*模块加载方法*/  \nstatic int __init hello_init(void){   \n    int err = -1;  \n    dev_t dev = 0;  \n    struct device* temp = NULL;  \n  \n    printk(KERN_ALERT\"Initializing hello device.\\n\");          \n  \n    /*动态分配主设备和从设备号*/  \n    err = alloc_chrdev_region(&dev, 0, 1, HELLO_DEVICE_NODE_NAME);  \n    if(err < 0) {  \n        printk(KERN_ALERT\"Failed to alloc char dev region.\\n\");  \n        goto fail;  \n    }  \n  \n    hello_major = MAJOR(dev);  \n    hello_minor = MINOR(dev);          \n  \n    /*分配helo设备结构体变量*/  \n    hello_dev = kmalloc(sizeof(struct hello_android_dev), GFP_KERNEL);  \n    if(!hello_dev) {  \n        err = -ENOMEM;  \n        printk(KERN_ALERT\"Failed to alloc hello_dev.\\n\");  \n        goto unregister;  \n    }          \n  \n    /*初始化设备*/  \n    err = __hello_setup_dev(hello_dev);  \n    if(err) {  \n        printk(KERN_ALERT\"Failed to setup dev: %d.\\n\", err);  \n        goto cleanup;  \n    }          \n  \n    /*在/sys/class/目录下创建设备类别目录hello*/  \n    hello_class = class_create(THIS_MODULE, HELLO_DEVICE_CLASS_NAME);  \n    if(IS_ERR(hello_class)) {  \n        err = PTR_ERR(hello_class);  \n        printk(KERN_ALERT\"Failed to create hello class.\\n\");  \n        goto destroy_cdev;  \n    }          \n  \n    /*在/dev/目录和/sys/class/hello目录下分别创建设备文件hello*/  \n    temp = device_create(hello_class, NULL, dev, \"%s\", HELLO_DEVICE_FILE_NAME);  \n    if(IS_ERR(temp)) {  \n        err = PTR_ERR(temp);  \n        printk(KERN_ALERT\"Failed to create hello device.\");  \n        goto destroy_class;  \n    }          \n  \n    /*在/sys/class/hello/hello目录下创建属性文件val*/  \n    err = device_create_file(temp, &dev_attr_val);  \n    if(err < 0) {  \n        printk(KERN_ALERT\"Failed to create attribute val.\");                  \n        goto destroy_device;  \n    }  \n  \n    dev_set_drvdata(temp, hello_dev);          \n  \n    /*创建/proc/hello文件*/  \n    hello_create_proc();  \n  \n    printk(KERN_ALERT\"Succedded to initialize hello device.\\n\");  \n    return 0;  \n  \ndestroy_device:  \n    device_destroy(hello_class, dev);  \n  \ndestroy_class:  \n    class_destroy(hello_class);  \n  \ndestroy_cdev:  \n    cdev_del(&(hello_dev->dev));  \n  \ncleanup:  \n    kfree(hello_dev);  \n  \nunregister:  \n    unregister_chrdev_region(MKDEV(hello_major, hello_minor), 1);  \n  \nfail:  \n    return err;  \n}  \n  \n/*模块卸载方法*/  \nstatic void __exit hello_exit(void) {  \n    dev_t devno = MKDEV(hello_major, hello_minor);  \n  \n    printk(KERN_ALERT\"Destroy hello device.\\n\");          \n  \n    /*删除/proc/hello文件*/  \n    hello_remove_proc();          \n  \n    /*销毁设备类别和设备*/  \n    if(hello_class) {  \n        device_destroy(hello_class, MKDEV(hello_major, hello_minor));  \n        class_destroy(hello_class);  \n    }          \n  \n    /*删除字符设备和释放设备内存*/  \n    if(hello_dev) {  \n        cdev_del(&(hello_dev->dev));  \n        kfree(hello_dev);  \n    }          \n  \n    /*释放设备号*/  \n    unregister_chrdev_region(devno, 1);  \n}  \n  \nMODULE_LICENSE(\"GPL\");  \nMODULE_DESCRIPTION(\"First Android Driver\");  \n  \nmodule_init(hello_init);  \nmodule_exit(hello_exit);  \n"
  },
  {
    "path": "Code/hello_KernelDriver/hello.h",
    "content": "#ifndef _HELLO_ANDROID_H_  \n#define _HELLO_ANDROID_H_  \n  \n#include <linux/cdev.h>  \n#include <linux/semaphore.h>  \n  \n#define HELLO_DEVICE_NODE_NAME  \"hello\"  \n#define HELLO_DEVICE_FILE_NAME  \"hello\"  \n#define HELLO_DEVICE_PROC_NAME  \"hello\"  \n#define HELLO_DEVICE_CLASS_NAME \"hello\"  \n  \nstruct hello_android_dev {  \n    int val;  \n    struct semaphore sem;  \n    struct cdev dev;  \n};  \n  \n#endif  \n"
  },
  {
    "path": "README.md",
    "content": "# PHDemo\n#### 《手机就是开发板》 目录\n##### 第一期 前言 http://blog.csdn.net/aggresss/article/details/53364324\n##### 第二期 AOSP 环境搭建、下载和编译 http://blog.csdn.net/aggresss/article/details/53393511\n##### 第三期 Android Kernel 下载和编译 http://blog.csdn.net/aggresss/article/details/53461464\n##### 第四期 Android Studio 开发环境搭建和Helloworld演示 http://blog.csdn.net/aggresss/article/details/53525468\n##### 第五期 基于模拟器上的实践和学习规划 http://blog.csdn.net/aggresss/article/details/53538575\n##### 第六期 基于模拟器的Helloworld 内核驱动 http://blog.csdn.net/aggresss/article/details/53557699\n##### 第七期 基于模拟器的Helloworld 可执行程序 http://blog.csdn.net/aggresss/article/details/53561241\n##### 第八期 基于模拟器的Helloworld HAL接口 http://blog.csdn.net/aggresss/article/details/53571487\n##### 第九期 基于模拟器的Helloworld JNI方法 http://blog.csdn.net/aggresss/article/details/53575075\n##### 第十期 基于模拟器的Helloworld Framework接口 http://blog.csdn.net/aggresss/article/details/53576022\n##### 第十一期 基于模拟器的Helloworld APP 访问硬件服务 http://blog.csdn.net/aggresss/article/details/53580520\n##### 第十二期 Android ROM结构分析 http://blog.csdn.net/aggresss/article/details/53955998\n##### 第十三期 AOSP 编译环境初始化过程分析 http://blog.csdn.net/aggresss/article/details/53968884\n##### 第十四期 AOSP 编译系统分析 http://blog.csdn.net/aggresss/article/details/53976626\n##### 第十五期 在AOSP上建立一个新产品 http://blog.csdn.net/aggresss/article/details/53985084\n##### 第十六期 CyanogenMod 小米3W刷机 http://blog.csdn.net/aggresss/article/details/53998257\n##### 第十七期 CyanogenMod 编译小米3W http://blog.csdn.net/aggresss/article/details/53999626\n##### 第十八期 Android GPS原理分析 http://blog.csdn.net/aggresss/article/details/54318662\n##### 第十九期 Android中修改GPS数据实验 http://blog.csdn.net/aggresss/article/details/54318905\n##### 第二十期 在Android中修改GPS定位数据的完整方案 http://blog.csdn.net/aggresss/article/details/54323034\n"
  },
  {
    "path": "Tools/51-android.rules",
    "content": "#Mi3W normal mode\nSUBSYSTEM==\"usb\",ATTR{idVendor}==\"2717\",ATTR{idProduct}==\"0360\",MODE=\"0666\"\n#Mi3W developer mode\nSUBSYSTEM==\"usb\",ATTR{idVendor}==\"2717\",ATTR{idProduct}==\"0368\",MODE=\"0666\"\n#Mi3W fastboot  mode\nSUBSYSTEM==\"usb\",ATTR{idVendor}==\"18d1\",ATTR{idProduct}==\"d00d\",MODE=\"0666\"\n#cyanogenmod recovry mode\nSUBSYSTEM==\"usb\",ATTR{idVendor}==\"18d1\",ATTR{idProduct}==\"d001\",MODE=\"0666\"\n"
  },
  {
    "path": "Tools/cancro/proprietary-files.txt",
    "content": "etc/sdm_200_HOG3x3_Grid3x3_bin5_noproj_zero_reduced.bin.pca\netc/android_model_faceg.dat\netc/permissions/qcrilhook.xml\netc/permissions/qcnvitems.xml\netc/android_model_facea.dat\netc/firmware/wcnss.b08\netc/firmware/wcnss.b06\netc/firmware/wcnss.mdt\netc/firmware/wcnss.b09\netc/firmware/a330_pm4.fw\netc/firmware/wcnss.b07\netc/firmware/wcnss.b00\netc/firmware/venus.b04\netc/firmware/a330_pfp.fw\netc/firmware/venus.b02\netc/firmware/wcnss.b02\netc/firmware/venus.mdt\netc/firmware/wcnss.b04\netc/firmware/cpp_firmware_v1_2_0.fw\netc/firmware/cpp_firmware_v1_1_6.fw\netc/firmware/cpp_firmware_v1_1_1.fw\netc/firmware/venus.b00\netc/firmware/venus.b01\netc/firmware/venus.mbn\netc/firmware/wcnss.b01\netc/firmware/venus.b03\netc/sensor_def_qcomdev.conf\netc/data/dsi_config.xml\netc/data/netmgr_config.xml\netc/data/qmi_config.xml\netc/sdm_200_HOG3x3_Grid3x3_bin5_noproj_zero_reduced.bin\npriv-app/qcrilmsgtunnel/qcrilmsgtunnel.apk\nlib/libdrmfs.so\nlib/libdrmdiag.so\nlib/libqomx_core.so\nlib/libchromatix_imx226_liveshot.so\nlib/hw/activity_recognition.msm8974.so\nlib/hw/gps.msm8974.so\nlib/hw/camera.vendor.msm8974.so\nlib/hw/consumerir.msm8974.so\nlib/libchromatix_imx214_liveshot.so\nlib/libqminvapi.so\nlib/libchromatix_imx219_liveshot.so\nlib/libchromatix_imx224_liveshot.so\nlib/libc2dcolorconvert.so\nlib/libchromatix_imx135_liveshot.so\nlib/libmmjpeg_interface.so\nlib/libloc_core.so\nlib/libloc_eng.so\nlib/libloc_ds_api.so\nlib/libchromatix_s5k3m2_liveshot.so\nlib/libgps.utils.so\nlib/libdrmtime.so\nlib/libmmcamera_interface.so\nlib/libstm-log.so\nlib/libloc_api_v02.so\nlib/libchromatix_imx225_liveshot.so\nlib/librpmb.so\nlib/libmdmdetect.so\nlib/drm/libdrmwvmplugin.so\nlib/libQSEEComAPI.so\nlib/libchromatix_imx215_liveshot.so\nlib/libOmxVenc.so\nlib/libRecoFace.so\nlib/libssd.so\nlib/libjhead.so\nlib/libjhead_jni.so\nlib/rfsa/adsp/libdspCV_skel.so\nlib/rfsa/adsp/libapps_mem_heap.so\nlib/rfsa/adsp/libfastcvadsp.so\nlib/rfsa/adsp/libfastcvadsp_skel.so\nlib/rfsa/adsp/libscveT2T_skel.so\nframework/qti-telephony-common.jar\nframework/qcnvitems.jar\nframework/qcrilhook.jar\nbin/rmt_storage\nbin/time_daemon\nbin/irsc_util\nbin/qmuxd\nbin/sensors.qcom\nbin/hvdcp\nbin/radish\nbin/mm-qcamera-daemon\nbin/lowi-server\nbin/qseecomd\nbin/xtwifi-client\nbin/charger_monitor\nbin/xtwifi-inet-agent\nbin/btnvtool\nbin/wcnss_filter\nbin/quipc_main\nbin/quipc_igsn\nbin/mpdecision\nbin/fm_qsoc_patches\nbin/netmgrd\nbin/rfs_access\nbin/wcnss_service\nbin/qosmgr\nbin/adsprpcd\nvendor/lib/libadreno_utils.so\nvendor/lib/libmmcamera2_vpe_module.so\nvendor/lib/libTimeService.so\nvendor/lib/libchromatix_imx132_default_video.so\nvendor/lib/libchromatix_imx215_preview.so\nvendor/lib/libchromatix_s5k3l1yx_hfr_120fps.so\nvendor/lib/libchromatix_imx226_common.so\nvendor/lib/libmmcamera2_cpp_module.so\nvendor/lib/libchromatix_s5k3m2_video_uhd.so\nvendor/lib/libmmcamera_hi256.so\nvendor/lib/libchromatix_s5k3m2_snapshot_hdr.so\nvendor/lib/libmm-hdcpmgr.so\nvendor/lib/libchromatix_skuf_ov12830_p12v01c_zsl.so\nvendor/lib/libchromatix_imx225_snapshot.so\nvendor/lib/libfastcvopt.so\nvendor/lib/libmmcamera_SKUAA_ST_gc0339.so\nvendor/lib/libchromatix_ov5648_oty5f03_common.so\nvendor/lib/libmmcamera2_frame_algorithm.so\nvendor/lib/libquipc_os_api.so\nvendor/lib/libchromatix_skuf_ov12830_p12v01c_default_video.so\nvendor/lib/libchromatix_ov8825_liveshot_hd.so\nvendor/lib/libcneapiclient.so\nvendor/lib/libchromatix_s5k3l1yx_hfr_90fps.so\nvendor/lib/libchromatix_ov5648_oty5f03_snapshot.so\nvendor/lib/libchromatix_imx224_snapshot_w.so\nvendor/lib/libjpegdhw.so\nvendor/lib/libacdbloader.so\nvendor/lib/libchromatix_ov9724_preview.so\nvendor/lib/libFaceProc.so\nvendor/lib/libchromatix_imx224_hfr_120.so\nvendor/lib/libchromatix_SKUAB_ST_s5k4e1_video_hd.so\nvendor/lib/libmm-abl.so\nvendor/lib/libchromatix_imx214_snapshot_w.so\nvendor/lib/libactuator_rohm_bu64243gwz_camcorder.so\nvendor/lib/libmmcamera_sunny_p12v01m_eeprom.so\nvendor/lib/libchromatix_s5k3l1yx_liveshot.so\nvendor/lib/libc2d30-a4xx.so\nvendor/lib/libsrsprocessing.so\nvendor/lib/libqct_resampler.so\nvendor/lib/libactuator_ov8825_camcorder.so\nvendor/lib/libchromatix_ov8825_preview.so\nvendor/lib/libchromatix_ov2720_default_video.so\nvendor/lib/libchromatix_imx215_video_hdr_uhd.so\nvendor/lib/libactuator_bu6313_camcorder.so\nvendor/lib/libchromatix_skuf_ov12830_p12v01c_video_hd.so\nvendor/lib/libactuator_dw9716_camera.so\nvendor/lib/libchromatix_ov8825_snapshot_hd.so\nvendor/lib/hw/sensors.msm8974.so\nvendor/lib/hw/flp.default.so\nvendor/lib/libchromatix_skuf_ov12830_p12v01c_hfr_60fps.so\nvendor/lib/libmmcamera_imx135.so\nvendor/lib/libchromatix_imx226_snapshot_hdr.so\nvendor/lib/libchromatix_imx215_snapshot_w.so\nvendor/lib/libWVStreamControlAPI_L1.so\nvendor/lib/libacdbrtac.so\nvendor/lib/mediadrm/libdrmclearkeyplugin.so\nvendor/lib/mediadrm/libwvdrmengine.so\nvendor/lib/libmmcamera_imx219.so\nvendor/lib/libRSDriver_adreno.so\nvendor/lib/libactuator_ad5823_camera.so\nvendor/lib/libchromatix_ov8825_snapshot.so\nvendor/lib/libdiag.so\nvendor/lib/libactuator_iu074_camera.so\nvendor/lib/libchromatix_ov4688_preview.so\nvendor/lib/libC2D2.so\nvendor/lib/libchromatix_imx215_snapshot_hdr.so\nvendor/lib/libchromatix_ov8865_q8v18a_zsl.so\nvendor/lib/libchromatix_imx214_snapshot.so\nvendor/lib/libacdbmapper.so\nvendor/lib/libchromatix_ov8865_q8v18a_video_hd.so\nvendor/lib/libchromatix_imx134_preview.so\nvendor/lib/libchromatix_ov5648_oty5f03_default_video.so\nvendor/lib/libsmemlog.so\nvendor/lib/liboemcamera.so\nvendor/lib/libchromatix_imx134_snapshot.so\nvendor/lib/libchromatix_imx224_video_uhd.so\nvendor/lib/libchromatix_skuf_ov5648_p5v23c_common.so\nvendor/lib/libchromatix_imx215_video_hdr.so\nvendor/lib/libchromatix_imx132_preview.so\nvendor/lib/libqcci_legacy.so\nvendor/lib/libactuator_dw9716.so\nvendor/lib/libchromatix_imx225_common.so\nvendor/lib/libchromatix_skuf_ov12830_p12v01c_hfr_90fps.so\nvendor/lib/libchromatix_imx214_snapshot_hdr.so\nvendor/lib/libchromatix_imx135_hfr_60.so\nvendor/lib/libxtwifi_ulp_adaptor.so\nvendor/lib/libchromatix_ov5648_oty5f03_zsl.so\nvendor/lib/libchromatix_SKUAA_ST_gc0339_default_video.so\nvendor/lib/libchromatix_ov8865_q8v18a_liveshot.so\nvendor/lib/lib-dplmedia.so\nvendor/lib/libchromatix_ov5648_oty5f03_preview.so\nvendor/lib/libtime_genoff.so\nvendor/lib/libmmcamera_imx226.so\nvendor/lib/liblocationservice.so\nvendor/lib/libactuator_ov12830_camera.so\nvendor/lib/libchromatix_ov8825_hfr_60fps.so\nvendor/lib/libchromatix_imx224_snapshot_hdr.so\nvendor/lib/libmmcamera_skuf_ov12830_p12v01c.so\nvendor/lib/libgeofence.so\nvendor/lib/libasn1crtx.so\nvendor/lib/librs_adreno_sha1.so\nvendor/lib/libchromatix_skuab_shinetech_gc0339_common.so\nvendor/lib/libmmcamera_ubifocus_lib.so\nvendor/lib/libchromatix_ov8865_q8v18a_default_video.so\nvendor/lib/libmmcamera2_iface_modules.so\nvendor/lib/libmmcamera_ov9724.so\nvendor/lib/libchromatix_imx214_video_hdr.so\nvendor/lib/libchromatix_SKUAB_ST_s5k4e1_snapshot.so\nvendor/lib/libchromatix_imx215_default_video.so\nvendor/lib/libactuator_ak7345.so\nvendor/lib/libchromatix_skuab_shinetech_gc0339_snapshot.so\nvendor/lib/libchromatix_ov8825_preview_hd.so\nvendor/lib/libchromatix_imx224_snapshot.so\nvendor/lib/libmmcamera_x5_imx214_eeprom.so\nvendor/lib/libmmcamera_chromaflash_lib.so\nvendor/lib/libchromatix_imx224_common.so\nvendor/lib/libchromatix_skuf_ov5648_p5v23c_default_video.so\nvendor/lib/liblbs_core.so\nvendor/lib/libchromatix_s5k3m2_video_hdr.so\nvendor/lib/libchromatix_imx219_common.so\nvendor/lib/libchromatix_skuf_ov12830_p12v01c_snapshot.so\nvendor/lib/libchromatix_imx226_video_hdr.so\nvendor/lib/libmmcamera_ov2720.so\nvendor/lib/libchromatix_imx226_snapshot_w.so\nvendor/lib/libqmi.so\nvendor/lib/libchromatix_imx214_video_uhd.so\nvendor/lib/libqmi_csvt_srvc.so\nvendor/lib/libchromatix_imx225_video_uhd.so\nvendor/lib/libchromatix_s5k3l1yx_default_video.so\nvendor/lib/libchromatix_ov8865_q8v18a_hfr_120fps.so\nvendor/lib/libCB.so\nvendor/lib/libchromatix_imx214_preview.so\nvendor/lib/libchromatix_skuab_shinetech_gc0339_default_video.so\nvendor/lib/libSHIMDivxDrm.so\nvendor/lib/libactuator_ov8825_camera.so\nvendor/lib/libchromatix_ov4688_zsl.so\nvendor/lib/libchromatix_SKUAA_ST_gc0339_common.so\nvendor/lib/libmmcamera2_sensor_modules.so\nvendor/lib/libaudioalsa.so\nvendor/lib/libchromatix_imx214_video_hdr_uhd.so\nvendor/lib/libchromatix_imx214_common.so\nvendor/lib/librs_adreno.so\nvendor/lib/libchromatix_SKUAB_ST_s5k4e1_default_video.so\nvendor/lib/libchromatix_imx134_hfr_60.so\nvendor/lib/libulp2.so\nvendor/lib/libchromatix_imx224_video_hdr.so\nvendor/lib/libril-qc-qmi-1.so\nvendor/lib/libmmcamera_truly_cm7700_eeprom.so\nvendor/lib/libchromatix_s5k3m2_hfr_120fps.so\nvendor/lib/libNimsWrap.so\nvendor/lib/libchromatix_ov4689_preview.so\nvendor/lib/libbccQTI.so\nvendor/lib/libmmcamera_tintless_bg_pca_algo.so\nvendor/lib/libqomx_jpegenc.so\nvendor/lib/libbtnv.so\nvendor/lib/libchromatix_imx219_default_video.so\nvendor/lib/libmmcamera2_is.so\nvendor/lib/libactuator_ad5823.so\nvendor/lib/libgsl.so\nvendor/lib/libchromatix_skuf_ov5648_p5v23c_snapshot.so\nvendor/lib/libmmcamera_SKUAB_ST_s5k4e1.so\nvendor/lib/libmmqjpeg_codec.so\nvendor/lib/libchromatix_s5k3l1yx_video_hd.so\nvendor/lib/libactuator_rohm_bu64243gwz_camera.so\nvendor/lib/libchromatix_skuf_ov12830_p12v01c_hfr_120fps.so\nvendor/lib/libchromatix_s5k3m2_snapshot_w.so\nvendor/lib/libchromatix_ov8825_video_hd.so\nvendor/lib/libchromatix_imx135_preview.so\nvendor/lib/libarcsoft_beauty_shot.so\nvendor/lib/libmmcamera_ov4688.so\nvendor/lib/libactuator_bu6313_camera.so\nvendor/lib/libchromatix_s5k3l1yx_zsl.so\nvendor/lib/libsensor_test.so\nvendor/lib/libmmcamera2_q3a_special.so\nvendor/lib/libmmcamera_ov4689.so\nvendor/lib/libchromatix_ov4689_common.so\nvendor/lib/libqti-perfd-client.so\nvendor/lib/lib-rtpsl.so\nvendor/lib/libmmcamera_imx225.so\nvendor/lib/libchromatix_ov8825_common.so\nvendor/lib/libmmcamera2_stats_algorithm.so\nvendor/lib/libchromatix_imx134_hfr_120.so\nvendor/lib/lib-rtpdaemoninterface.so\nvendor/lib/libactuator_bu6313.so\nvendor/lib/libchromatix_ov4689_zsl.so\nvendor/lib/libOpenCL.so\nvendor/lib/libmmcamera_imx224.so\nvendor/lib/libchromatix_skuf_ov12830_p12v01c_common.so\nvendor/lib/libchromatix_SKUAB_ST_s5k4e1_liveshot.so\nvendor/lib/libsensor_reg.so\nvendor/lib/libasn1crt.so\nvendor/lib/libmmcamera2_pproc_modules.so\nvendor/lib/libt2tmanager.so\nvendor/lib/libchromatix_imx225_preview.so\nvendor/lib/libchromatix_s5k3m2_preview.so\nvendor/lib/libactuator_iu074.so\nvendor/lib/libchromatix_SKUAA_ST_gc0339_preview.so\nvendor/lib/libchromatix_imx132_snapshot.so\nvendor/lib/libchromatix_ov8865_q8v18a_preview.so\nvendor/lib/libchromaflash.so\nvendor/lib/libjpegehw.so\nvendor/lib/libqmi_client_qmux.so\nvendor/lib/libfastcvadsp_stub.so\nvendor/lib/libc2d30-a3xx.so\nvendor/lib/soundfx/libqcbassboost.so\nvendor/lib/soundfx/libqcreverb.so\nvendor/lib/soundfx/libqcvirt.so\nvendor/lib/soundfx/libdirac.so\nvendor/lib/libchromatix_imx224_video_hdr_uhd.so\nvendor/lib/libmmipl.so\nvendor/lib/libqmi_common_so.so\nvendor/lib/libmm-abl-oem.so\nvendor/lib/libchromatix_s5k3m2_default_video.so\nvendor/lib/libchromatix_ov9724_default_video.so\nvendor/lib/libmmQSM.so\nvendor/lib/libchromatix_imx225_video_hdr_uhd.so\nvendor/lib/libactuator_ad5823_camcorder.so\nvendor/lib/libWVphoneAPI.so\nvendor/lib/libaudcal.so\nvendor/lib/libchromatix_imx219_snapshot.so\nvendor/lib/libmmcamera_skuab_shinetech_gc0339.so\nvendor/lib/libizat_core.so\nvendor/lib/libactuator_rohm_bu64243gwz.so\nvendor/lib/libdsutils.so\nvendor/lib/libchromatix_imx215_hfr_120.so\nvendor/lib/libchromatix_imx226_hfr_120.so\nvendor/lib/libactuator_ak7345_camcorder.so\nvendor/lib/libchromatix_ov2720_liveshot.so\nvendor/lib/libwvdrm_L1.so\nvendor/lib/libactuator_lc8214_camera.so\nvendor/lib/libmmcamera2_wnr_module.so\nvendor/lib/libmmcamera_imglib.so\nvendor/lib/libquipc_ulp_adapter.so\nvendor/lib/libmmcamera_faceproc.so\nvendor/lib/libchromatix_ov4688_hfr.so\nvendor/lib/libasn1cper.so\nvendor/lib/libchromatix_imx214_hfr_120.so\nvendor/lib/libmmcamera_s5k3m2.so\nvendor/lib/libchromatix_ov9724_liveshot.so\nvendor/lib/libmmjpeg.so\nvendor/lib/libchromatix_imx214_default_video.so\nvendor/lib/libmmcamera2_stats_modules.so\nvendor/lib/libnetmgr.so\nvendor/lib/libchromatix_imx219_preview.so\nvendor/lib/libmmcamera_sunny_q8v18a_eeprom.so\nvendor/lib/libscve.so\nvendor/lib/libchromatix_ov8825_default_video.so\nvendor/lib/libchromatix_ov2720_hfr.so\nvendor/lib/libchromatix_ov4688_liveshot.so\nvendor/lib/libmmcamera2_c2d_module.so\nvendor/lib/libactuator_lc8214_camcorder.so\nvendor/lib/libchromatix_skuab_shinetech_gc0339_liveshot.so\nvendor/lib/libchromatix_s5k3l1yx_preview.so\nvendor/lib/libmmcamera_sunny_p5v23c_eeprom.so\nvendor/lib/libI420colorconvert.so\nvendor/lib/libchromatix_skuab_shinetech_gc0339_preview.so\nvendor/lib/libsensor_user_cal.so\nvendor/lib/libDivxDrm.so\nvendor/lib/libDiracAPI_SHARED.so\nvendor/lib/libchromatix_ov4688_common.so\nvendor/lib/libchromatix_imx225_default_video.so\nvendor/lib/libqdp.so\nvendor/lib/libchromatix_ov8825_hfr_120fps.so\nvendor/lib/libchromatix_imx226_video_hdr_uhd.so\nvendor/lib/libHevcSwDecoder.so\nvendor/lib/libchromatix_ov2720_common.so\nvendor/lib/libchromatix_ov4689_hfr.so\nvendor/lib/libchromatix_ov9724_common.so\nvendor/lib/libmmcamera_wavelet_lib.so\nvendor/lib/libchromatix_imx226_default_video.so\nvendor/lib/libmmcamera_mt9m114.so\nvendor/lib/libchromatix_ov8825_hfr_90fps.so\nvendor/lib/libqmi_cci.so\nvendor/lib/libchromatix_imx224_preview.so\nvendor/lib/libchromatix_imx225_snapshot_hdr.so\nvendor/lib/libchromatix_skuab_shinetech_gc0339_zsl.so\nvendor/lib/libscve_stub.so\nvendor/lib/libactuator_dw9714_camera.so\nvendor/lib/libchromatix_imx215_snapshot.so\nvendor/lib/egl/eglsubAndroid.so\nvendor/lib/egl/libq3dtools_adreno.so\nvendor/lib/egl/libEGL_adreno.so\nvendor/lib/egl/libGLESv1_CM_adreno.so\nvendor/lib/egl/libGLESv2_adreno.so\nvendor/lib/libmmosal.so\nvendor/lib/libsc-a2xx.so\nvendor/lib/libchromatix_s5k3l1yx_hfr_60fps.so\nvendor/lib/libconfigdb.so\nvendor/lib/libchromatix_SKUAB_ST_s5k4e1_zsl.so\nvendor/lib/libmmcamera_imx214.so\nvendor/lib/libmmcamera2_imglib_modules.so\nvendor/lib/libchromatix_ov8825_zsl.so\nvendor/lib/libchromatix_imx215_video_uhd.so\nvendor/lib/libactuator_ov12830_camcorder.so\nvendor/lib/libchromatix_ov4689_default_video.so\nvendor/lib/libmmcamera_ov5648_oty5f03.so\nvendor/lib/libsystem_health_mon.so\nvendor/lib/libqmi_csi.so\nvendor/lib/libxtadapter.so\nvendor/lib/libchromatix_imx226_snapshot.so\nvendor/lib/libmmcamera_imx134.so\nvendor/lib/libmmcamera2_isp_modules.so\nvendor/lib/libchromatix_skuf_ov12830_p12v01c_preview.so\nvendor/lib/libmmcamera_tintless_algo.so\nvendor/lib/libmmcamera_imx132.so\nvendor/lib/libchromatix_skuf_ov5648_p5v23c_preview.so\nvendor/lib/libchromatix_s5k3m2_common.so\nvendor/lib/libchromatix_SKUAB_ST_s5k4e1_common.so\nvendor/lib/libchromatix_imx135_hfr_90.so\nvendor/lib/libchromatix_SKUAB_ST_s5k4e1_hfr_90fps.so\nvendor/lib/libxtwifi_zpp_adaptor.so\nvendor/lib/libchromatix_s5k3l1yx_snapshot.so\nvendor/lib/libmm-color-convertor.so\nvendor/lib/libactuator_lc8214.so\nvendor/lib/libmmcamera_hdr_gb_lib.so\nvendor/lib/lib-rtpcommon.so\nvendor/lib/libchromatix_ov8865_q8v18a_snapshot.so\nvendor/lib/libchromatix_SKUAB_ST_s5k4e1_hfr_60fps.so\nvendor/lib/libperipheral_client.so\nvendor/lib/libsc-a3xx.so\nvendor/lib/libchromatix_ov4688_default_video.so\nvendor/lib/libchromatix_imx135_common.so\nvendor/lib/libchromatix_SKUAB_ST_s5k4e1_hfr_120fps.so\nvendor/lib/libchromatix_ov8825_liveshot.so\nvendor/lib/libmmcamera_skuf_ov5648_p5v23c.so\nvendor/lib/libactuator_dw9716_camcorder.so\nvendor/lib/libmmcamera_ov8865_q8v18a.so\nvendor/lib/libchromatix_s5k3m2_snapshot.so\nvendor/lib/libmmcamera_s5k3l1yx.so\nvendor/lib/libchromatix_SKUAB_ST_s5k4e1_preview.so\nvendor/lib/libmmcamera_hdr_lib.so\nvendor/lib/libqomx_jpegdec.so\nvendor/lib/libchromatix_imx134_common.so\nvendor/lib/libchromatix_imx215_common.so\nvendor/lib/liboemcrypto.so\nvendor/lib/libmmcamera_imx215.so\nvendor/lib/libsensor1.so\nvendor/lib/libllvm-qcom.so\nvendor/lib/libactuator_iu074_camcorder.so\nvendor/lib/libchromatix_ov4689_liveshot.so\nvendor/lib/libchromatix_imx134_default_video.so\nvendor/lib/libadsprpc.so\nvendor/lib/libchromatix_imx225_snapshot_w.so\nvendor/lib/libril-qcril-hook-oem.so\nvendor/lib/libdsi_netctrl.so\nvendor/lib/libscale.so\nvendor/lib/libchromatix_s5k3m2_video_hdr_uhd.so\nvendor/lib/libchromatix_imx135_hfr_120.so\nvendor/lib/libadiertac.so\nvendor/lib/libactuator_ov8825.so\nvendor/lib/libchromatix_imx226_video_uhd.so\nvendor/lib/libactuator_dw9714.so\nvendor/lib/libdisp-aba.so\nvendor/lib/libAKM8963.so\nvendor/lib/libchromatix_ov8865_q8v18a_hfr_90fps.so\nvendor/lib/libwifiscanner.so\nvendor/lib/libactuator_ov12830.so\nvendor/lib/libchromatix_imx132_common.so\nvendor/lib/libwvm.so\nvendor/lib/libchromatix_imx226_preview.so\nvendor/lib/libchromatix_ov2720_preview.so\nvendor/lib/libchromatix_imx225_video_hdr.so\nvendor/lib/libqmiservices.so\nvendor/lib/libmmcamera_ofilm_oty5f03_eeprom.so\nvendor/lib/libqmi_encdec.so\nvendor/lib/libchromatix_imx225_hfr_120.so\nvendor/lib/libmmcamera_x4_s5k3m2_eeprom.so\nvendor/lib/libchromatix_ov8865_q8v18a_common.so\nvendor/lib/libxml.so\nvendor/lib/libchromatix_ov2720_zsl.so\nvendor/lib/libmmcamera_ov8825.so\nvendor/lib/libchromatix_imx135_default_video.so\nvendor/lib/libactuator_ak7345_camera.so\nvendor/lib/libchromatix_imx132_liveshot.so\nvendor/lib/lib-rtpcore.so\nvendor/lib/libchromatix_imx135_snapshot.so\nvendor/lib/libchromatix_s5k3l1yx_common.so\nvendor/lib/libqdi.so\nvendor/lib/libidl.so\nvendor/lib/libactuator_dw9714_camcorder.so\nvendor/lib/libchromatix_imx224_default_video.so\nvendor/lib/libmmcamera_sp1628.so\nvendor/lib/libchromatix_imx135_video_hd.so\nvendor/lib/libchromatix_ov8865_q8v18a_hfr_60fps.so\nvendor/lib/libdrmdecrypt.so\nvendor/firmware/keymaster/keymaster.b01\nvendor/firmware/keymaster/keymaster.b02\nvendor/firmware/keymaster/keymaster.b00\nvendor/firmware/keymaster/keymaster.b03\nvendor/firmware/keymaster/keymaster.mdt\nvendor/firmware/bcm2079x-b5_pre_firmware.ncd\nvendor/firmware/bcm2079x-b5_firmware.ncd\napp/Snap/Snap.apk\napp/TimeService/TimeService.apk\napp/shutdownlistener/shutdownlistener.apk\n../sbin/e2fsck_static\n../sbin/chargeonlymode\n"
  },
  {
    "path": "Tools/sdat2img.py",
    "content": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n#====================================================\n#          FILE: sdat2img.py\n#       AUTHORS: xpirt - luxi78 - howellzhu\n#          DATE: 2016-11-23 16:20:11 CST\n#====================================================\n\nimport sys, os, errno\n\n__version__ = '1.0'\n\nif sys.hexversion < 0x02070000:\n    print >> sys.stderr, \"Python 2.7 or newer is required.\"\n    try:\n       input = raw_input\n    except NameError: pass\n    input('Press ENTER to exit...')\n    sys.exit(1)\nelse:\n    print('sdat2img binary - version: %s\\n' % __version__)\n\ntry:\n    TRANSFER_LIST_FILE = str(sys.argv[1])\n    NEW_DATA_FILE = str(sys.argv[2])\nexcept IndexError:\n    print('\\nUsage: sdat2img.py <transfer_list> <system_new_file> [system_img]\\n')\n    print('    <transfer_list>: transfer list file')\n    print('    <system_new_file>: system new dat file')\n    print('    [system_img]: output system image\\n\\n')\n    print('Visit xda thread for more information.\\n')\n    try:\n       input = raw_input\n    except NameError: pass\n    input('Press ENTER to exit...')\n    sys.exit()\n\ntry:\n    OUTPUT_IMAGE_FILE = str(sys.argv[3])\nexcept IndexError:\n    OUTPUT_IMAGE_FILE = 'system.img'\n\nBLOCK_SIZE = 4096\n\ndef rangeset(src):\n    src_set = src.split(',')\n    num_set =  [int(item) for item in src_set]\n    if len(num_set) != num_set[0]+1:\n        print('Error on parsing following data to rangeset:\\n%s' % src)\n        sys.exit(1)\n\n    return tuple ([ (num_set[i], num_set[i+1]) for i in range(1, len(num_set), 2) ])\n\ndef parse_transfer_list_file(path):\n    trans_list = open(TRANSFER_LIST_FILE, 'r')\n\n    # First line in transfer list is the version number\n    version = int(trans_list.readline())\n\n    # Second line in transfer list is the total number of blocks we expect to write\n    new_blocks = int(trans_list.readline())\n\n    if version >= 2:\n        # Third line is how many stash entries are needed simultaneously\n        trans_list.readline()\n        # Fourth line is the maximum number of blocks that will be stashed simultaneously\n        trans_list.readline()\n\n    # Subsequent lines are all individual transfer commands\n    commands = []\n    for line in trans_list:\n        line = line.split(' ')\n        cmd = line[0]\n        if cmd in ['erase', 'new', 'zero']:\n            commands.append([cmd, rangeset(line[1])])\n        else:\n            # Skip lines starting with numbers, they are not commands anyway\n            if not cmd[0].isdigit():\n                print('Command \"%s\" is not valid.' % cmd)\n                trans_list.close()\n                sys.exit(1)\n\n    trans_list.close()\n    return version, new_blocks, commands\n\ndef main(argv):\n    version, new_blocks, commands = parse_transfer_list_file(TRANSFER_LIST_FILE)\n\n    if version == 1:\n        print('Android Lollipop 5.0 detected!\\n')\n    elif version == 2:\n        print('Android Lollipop 5.1 detected!\\n')\n    elif version == 3:\n        print('Android Marshmallow 6.0 detected!\\n')\n    elif version == 4:\n        print('Android Nougat 7.0 detected!\\n')\n    else:\n        print('Unknown Android version!\\n')\n\n    # Don't clobber existing files to avoid accidental data loss\n    try:\n        output_img = open(OUTPUT_IMAGE_FILE, 'wb')\n    except IOError as e:\n        if e.errno == errno.EEXIST:\n            print('Error: the output file \"{}\" already exists'.format(e.filename))\n            print('Remove it, rename it, or choose a different file name.')\n            sys.exit(e.errno)\n        else:\n            raise\n\n    new_data_file = open(NEW_DATA_FILE, 'rb')\n    all_block_sets = [i for command in commands for i in command[1]]\n    max_file_size = max(pair[1] for pair in all_block_sets)*BLOCK_SIZE\n\n    for command in commands:\n        if command[0] == 'new':\n            for block in command[1]:\n                begin = block[0]\n                end = block[1]\n                block_count = end - begin\n                print('Copying {} blocks into position {}...'.format(block_count, begin))\n\n                # Position output file\n                output_img.seek(begin*BLOCK_SIZE)\n                \n                # Copy one block at a time\n                while(block_count > 0):\n                    output_img.write(new_data_file.read(BLOCK_SIZE))\n                    block_count -= 1\n        else:\n            print('Skipping command %s...' % command[0])\n\n    # Make file larger if necessary\n    if(output_img.tell() < max_file_size):\n        output_img.truncate(max_file_size)\n\n    output_img.close()\n    new_data_file.close()\n    print('Done! Output image: %s' % os.path.realpath(output_img.name))\n\nif __name__ == '__main__':\n    main(sys.argv)\n"
  },
  {
    "path": "VirtualPosition/Modification/com_android_server_location_GpsLocationProvider.cpp",
    "content": "/*\n * Copyright (C) 2008 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#define LOG_TAG \"GpsLocationProvider\"\n\n#define LOG_NDEBUG 0\n\n#include \"JNIHelp.h\"\n#include \"jni.h\"\n#include \"hardware/hardware.h\"\n#include \"hardware/gps.h\"\n#include \"hardware/vp.h\"\n#include \"hardware_legacy/power.h\"\n#include \"utils/Log.h\"\n#include \"utils/misc.h\"\n#include \"android_runtime/AndroidRuntime.h\"\n#include \"android_runtime/Log.h\"\n\n#include <fcntl.h>  \n#include <arpa/inet.h>\n#include <string.h>\n#include <pthread.h>\n#include <linux/in.h>\n#include <linux/in6.h>\n\nstatic jobject mCallbacksObj = NULL;\n\nstatic jmethodID method_reportLocation;\nstatic jmethodID method_reportStatus;\nstatic jmethodID method_reportSvStatus;\nstatic jmethodID method_reportAGpsStatus;\nstatic jmethodID method_reportNmea;\nstatic jmethodID method_setEngineCapabilities;\nstatic jmethodID method_xtraDownloadRequest;\nstatic jmethodID method_reportNiNotification;\nstatic jmethodID method_requestRefLocation;\nstatic jmethodID method_requestSetID;\nstatic jmethodID method_requestUtcTime;\nstatic jmethodID method_reportGeofenceTransition;\nstatic jmethodID method_reportGeofenceStatus;\nstatic jmethodID method_reportGeofenceAddStatus;\nstatic jmethodID method_reportGeofenceRemoveStatus;\nstatic jmethodID method_reportGeofencePauseStatus;\nstatic jmethodID method_reportGeofenceResumeStatus;\nstatic jmethodID method_reportMeasurementData;\nstatic jmethodID method_reportNavigationMessages;\n\nstatic const GpsInterface* sGpsInterface = NULL;\nstatic const GpsXtraInterface* sGpsXtraInterface = NULL;\nstatic const AGpsInterface* sAGpsInterface = NULL;\nstatic const GpsNiInterface* sGpsNiInterface = NULL;\nstatic const GpsDebugInterface* sGpsDebugInterface = NULL;\nstatic const AGpsRilInterface* sAGpsRilInterface = NULL;\nstatic const GpsGeofencingInterface* sGpsGeofencingInterface = NULL;\nstatic const GpsMeasurementInterface* sGpsMeasurementInterface = NULL;\nstatic const GpsNavigationMessageInterface* sGpsNavigationMessageInterface = NULL;\nstatic const GnssConfigurationInterface* sGnssConfigurationInterface = NULL;\n\n// temporary storage for GPS callbacks\nstatic GpsSvStatus  sGpsSvStatus;\nstatic const char* sNmeaString;\nstatic int sNmeaStringLength;\n\n#define WAKE_LOCK_NAME  \"GPS\"\nnamespace android {\n\n// add by aggresss\nstatic int vp_fd = open(\"/dev/vp\", O_RDWR); \nstatic VirtualPosition vp_val;\n\n\nstatic void checkAndClearExceptionFromCallback(JNIEnv* env, const char* methodName) {\n    if (env->ExceptionCheck()) {\n        ALOGE(\"An exception was thrown by callback '%s'.\", methodName);\n        LOGE_EX(env);\n        env->ExceptionClear();\n    }\n}\n\nstatic void location_callback(GpsLocation* location)\n{\n    JNIEnv* env = AndroidRuntime::getJNIEnv();\n    //add by aggresss\n    read(vp_fd, &vp_val, sizeof(VirtualPosition));\n    if(vp_val.toggle  == 1){\n    env->CallVoidMethod(mCallbacksObj, method_reportLocation, location->flags,\n            (jdouble)vp_val.virtual_latitude, (jdouble)vp_val.virtual_longitude,\n            (jdouble)location->altitude,\n            (jfloat)location->speed, (jfloat)location->bearing,\n            (jfloat)location->accuracy, (jlong)location->timestamp);\n    checkAndClearExceptionFromCallback(env, __FUNCTION__);\n    }\n    else{\n    env->CallVoidMethod(mCallbacksObj, method_reportLocation, location->flags,\n            (jdouble)location->latitude, (jdouble)location->longitude,\n            (jdouble)location->altitude,\n            (jfloat)location->speed, (jfloat)location->bearing,\n            (jfloat)location->accuracy, (jlong)location->timestamp);\n    checkAndClearExceptionFromCallback(env, __FUNCTION__);\n    }\n}\n\nstatic void status_callback(GpsStatus* status)\n{\n    JNIEnv* env = AndroidRuntime::getJNIEnv();\n    env->CallVoidMethod(mCallbacksObj, method_reportStatus, status->status);\n    checkAndClearExceptionFromCallback(env, __FUNCTION__);\n}\n\nstatic void sv_status_callback(GpsSvStatus* sv_status)\n{\n    JNIEnv* env = AndroidRuntime::getJNIEnv();\n    memcpy(&sGpsSvStatus, sv_status, sizeof(sGpsSvStatus));\n    env->CallVoidMethod(mCallbacksObj, method_reportSvStatus);\n    checkAndClearExceptionFromCallback(env, __FUNCTION__);\n}\n\nstatic void nmea_callback(GpsUtcTime timestamp, const char* nmea, int length)\n{\n    JNIEnv* env = AndroidRuntime::getJNIEnv();\n    // The Java code will call back to read these values\n    // We do this to avoid creating unnecessary String objects\n    sNmeaString = nmea;\n    sNmeaStringLength = length;\n    env->CallVoidMethod(mCallbacksObj, method_reportNmea, timestamp);\n    checkAndClearExceptionFromCallback(env, __FUNCTION__);\n}\n\nstatic void set_capabilities_callback(uint32_t capabilities)\n{\n    ALOGD(\"set_capabilities_callback: %du\\n\", capabilities);\n    JNIEnv* env = AndroidRuntime::getJNIEnv();\n    env->CallVoidMethod(mCallbacksObj, method_setEngineCapabilities, capabilities);\n    checkAndClearExceptionFromCallback(env, __FUNCTION__);\n}\n\nstatic void acquire_wakelock_callback()\n{\n    acquire_wake_lock(PARTIAL_WAKE_LOCK, WAKE_LOCK_NAME);\n}\n\nstatic void release_wakelock_callback()\n{\n    release_wake_lock(WAKE_LOCK_NAME);\n}\n\nstatic void request_utc_time_callback()\n{\n    JNIEnv* env = AndroidRuntime::getJNIEnv();\n    env->CallVoidMethod(mCallbacksObj, method_requestUtcTime);\n    checkAndClearExceptionFromCallback(env, __FUNCTION__);\n}\n\nstatic pthread_t create_thread_callback(const char* name, void (*start)(void *), void* arg)\n{\n    return (pthread_t)AndroidRuntime::createJavaThread(name, start, arg);\n}\n\nGpsCallbacks sGpsCallbacks = {\n    sizeof(GpsCallbacks),\n    location_callback,\n    status_callback,\n    sv_status_callback,\n    nmea_callback,\n    set_capabilities_callback,\n    acquire_wakelock_callback,\n    release_wakelock_callback,\n    create_thread_callback,\n    request_utc_time_callback,\n};\n\nstatic void xtra_download_request_callback()\n{\n    JNIEnv* env = AndroidRuntime::getJNIEnv();\n    env->CallVoidMethod(mCallbacksObj, method_xtraDownloadRequest);\n    checkAndClearExceptionFromCallback(env, __FUNCTION__);\n}\n\nGpsXtraCallbacks sGpsXtraCallbacks = {\n    xtra_download_request_callback,\n    create_thread_callback,\n};\n\nstatic jbyteArray convert_to_ipv4(uint32_t ip, bool net_order)\n{\n    if (INADDR_NONE == ip) {\n        return NULL;\n    }\n\n    JNIEnv* env = AndroidRuntime::getJNIEnv();\n    jbyteArray byteArray = env->NewByteArray(4);\n    if (byteArray == NULL) {\n        ALOGE(\"Unable to allocate byte array for IPv4 address\");\n        return NULL;\n    }\n\n    jbyte ipv4[4];\n    if (net_order) {\n        ALOGV(\"Converting IPv4 address(net_order) %x\", ip);\n        memcpy(ipv4, &ip, sizeof(ipv4));\n    } else {\n        ALOGV(\"Converting IPv4 address(host_order) %x\", ip);\n        //endianess transparent conversion from int to char[]\n        ipv4[0] = (jbyte) (ip & 0xFF);\n        ipv4[1] = (jbyte)((ip>>8) & 0xFF);\n        ipv4[2] = (jbyte)((ip>>16) & 0xFF);\n        ipv4[3] = (jbyte) (ip>>24);\n    }\n\n    env->SetByteArrayRegion(byteArray, 0, 4, (const jbyte*) ipv4);\n    return byteArray;\n}\n\nstatic void agps_status_callback(AGpsStatus* agps_status)\n{\n    JNIEnv* env = AndroidRuntime::getJNIEnv();\n    jbyteArray byteArray = NULL;\n    bool isSupported = false;\n\n    size_t status_size = agps_status->size;\n    if (status_size == sizeof(AGpsStatus_v3)) {\n      ALOGV(\"AGpsStatus is V3: %zd\", status_size);\n      switch (agps_status->addr.ss_family)\n      {\n      case AF_INET:\n          {\n            struct sockaddr_in *in = (struct sockaddr_in*)&(agps_status->addr);\n            uint32_t ipAddr = *(uint32_t*)&(in->sin_addr);\n            byteArray = convert_to_ipv4(ipAddr, true /* net_order */);\n            if (ipAddr == INADDR_NONE || byteArray != NULL) {\n                isSupported = true;\n            }\n            IF_ALOGD() {\n                // log the IP for reference in case there is a bogus value pushed by HAL\n                char str[INET_ADDRSTRLEN];\n                inet_ntop(AF_INET, &(in->sin_addr), str, INET_ADDRSTRLEN);\n                ALOGD(\"AGPS IP is v4: %s\", str);\n            }\n          }\n          break;\n      case AF_INET6:\n          {\n            struct sockaddr_in6 *in6 = (struct sockaddr_in6*)&(agps_status->addr);\n            byteArray = env->NewByteArray(16);\n            if (byteArray != NULL) {\n                env->SetByteArrayRegion(byteArray, 0, 16, (const jbyte *)&(in6->sin6_addr));\n                isSupported = true;\n            } else {\n                ALOGE(\"Unable to allocate byte array for IPv6 address.\");\n            }\n            IF_ALOGD() {\n                // log the IP for reference in case there is a bogus value pushed by HAL\n                char str[INET6_ADDRSTRLEN];\n                inet_ntop(AF_INET6, &(in6->sin6_addr), str, INET6_ADDRSTRLEN);\n                ALOGD(\"AGPS IP is v6: %s\", str);\n            }\n          }\n          break;\n      default:\n          ALOGE(\"Invalid ss_family found: %d\", agps_status->addr.ss_family);\n          break;\n      }\n    } else if (status_size >= sizeof(AGpsStatus_v2)) {\n      ALOGV(\"AGpsStatus is V2+: %zd\", status_size);\n      // for back-compatibility reasons we check in v2 that the data structure size is greater or\n      // equal to the declared size in gps.h\n      uint32_t ipaddr = agps_status->ipaddr;\n      ALOGV(\"AGPS IP is v4: %x\", ipaddr);\n      byteArray = convert_to_ipv4(ipaddr, false /* net_order */);\n      if (ipaddr == INADDR_NONE || byteArray != NULL) {\n          isSupported = true;\n      }\n    } else if (status_size >= sizeof(AGpsStatus_v1)) {\n        ALOGV(\"AGpsStatus is V1+: %zd\", status_size);\n        // because we have to check for >= with regards to v2, we also need to relax the check here\n        // and only make sure that the size is at least what we expect\n        isSupported = true;\n    } else {\n        ALOGE(\"Invalid size of AGpsStatus found: %zd.\", status_size);\n    }\n\n    if (isSupported) {\n        jsize byteArrayLength = byteArray != NULL ? env->GetArrayLength(byteArray) : 0;\n        ALOGV(\"Passing AGPS IP addr: size %d\", byteArrayLength);\n        env->CallVoidMethod(mCallbacksObj, method_reportAGpsStatus, agps_status->type,\n                            agps_status->status, byteArray);\n\n        checkAndClearExceptionFromCallback(env, __FUNCTION__);\n    } else {\n        ALOGD(\"Skipping calling method_reportAGpsStatus.\");\n    }\n\n    if (byteArray) {\n        env->DeleteLocalRef(byteArray);\n    }\n}\n\nAGpsCallbacks sAGpsCallbacks = {\n    agps_status_callback,\n    create_thread_callback,\n};\n\nstatic void gps_ni_notify_callback(GpsNiNotification *notification)\n{\n    ALOGD(\"gps_ni_notify_callback\\n\");\n    JNIEnv* env = AndroidRuntime::getJNIEnv();\n    jstring requestor_id = env->NewStringUTF(notification->requestor_id);\n    jstring text = env->NewStringUTF(notification->text);\n    jstring extras = env->NewStringUTF(notification->extras);\n\n    if (requestor_id && text && extras) {\n        env->CallVoidMethod(mCallbacksObj, method_reportNiNotification,\n            notification->notification_id, notification->ni_type,\n            notification->notify_flags, notification->timeout,\n            notification->default_response, requestor_id, text,\n            notification->requestor_id_encoding,\n            notification->text_encoding, extras);\n    } else {\n        ALOGE(\"out of memory in gps_ni_notify_callback\\n\");\n    }\n\n    if (requestor_id)\n        env->DeleteLocalRef(requestor_id);\n    if (text)\n        env->DeleteLocalRef(text);\n    if (extras)\n        env->DeleteLocalRef(extras);\n    checkAndClearExceptionFromCallback(env, __FUNCTION__);\n}\n\nGpsNiCallbacks sGpsNiCallbacks = {\n    gps_ni_notify_callback,\n    create_thread_callback,\n};\n\nstatic void agps_request_set_id(uint32_t flags)\n{\n    JNIEnv* env = AndroidRuntime::getJNIEnv();\n    env->CallVoidMethod(mCallbacksObj, method_requestSetID, flags);\n    checkAndClearExceptionFromCallback(env, __FUNCTION__);\n}\n\nstatic void agps_request_ref_location(uint32_t flags)\n{\n    JNIEnv* env = AndroidRuntime::getJNIEnv();\n    env->CallVoidMethod(mCallbacksObj, method_requestRefLocation, flags);\n    checkAndClearExceptionFromCallback(env, __FUNCTION__);\n}\n\nAGpsRilCallbacks sAGpsRilCallbacks = {\n    agps_request_set_id,\n    agps_request_ref_location,\n    create_thread_callback,\n};\n\nstatic void gps_geofence_transition_callback(int32_t geofence_id,  GpsLocation* location,\n        int32_t transition, GpsUtcTime timestamp)\n{\n    JNIEnv* env = AndroidRuntime::getJNIEnv();\n\n    env->CallVoidMethod(mCallbacksObj, method_reportGeofenceTransition, geofence_id,\n            location->flags, (jdouble)location->latitude, (jdouble)location->longitude,\n            (jdouble)location->altitude,\n            (jfloat)location->speed, (jfloat)location->bearing,\n            (jfloat)location->accuracy, (jlong)location->timestamp,\n            transition, timestamp);\n    checkAndClearExceptionFromCallback(env, __FUNCTION__);\n};\n\nstatic void gps_geofence_status_callback(int32_t status, GpsLocation* location)\n{\n    JNIEnv* env = AndroidRuntime::getJNIEnv();\n    jint flags = 0;\n    jdouble latitude = 0;\n    jdouble longitude = 0;\n    jdouble altitude = 0;\n    jfloat speed = 0;\n    jfloat bearing = 0;\n    jfloat accuracy = 0;\n    jlong timestamp = 0;\n    if (location != NULL) {\n        flags = location->flags;\n        latitude = location->latitude;\n        longitude = location->longitude;\n        altitude = location->altitude;\n        speed = location->speed;\n        bearing = location->bearing;\n        accuracy = location->accuracy;\n        timestamp = location->timestamp;\n    }\n\n    env->CallVoidMethod(mCallbacksObj, method_reportGeofenceStatus, status,\n            flags, latitude, longitude, altitude, speed, bearing, accuracy, timestamp);\n    checkAndClearExceptionFromCallback(env, __FUNCTION__);\n};\n\nstatic void gps_geofence_add_callback(int32_t geofence_id, int32_t status)\n{\n    JNIEnv* env = AndroidRuntime::getJNIEnv();\n    if (status != GPS_GEOFENCE_OPERATION_SUCCESS) {\n        ALOGE(\"Error in geofence_add_callback: %d\\n\", status);\n    }\n    env->CallVoidMethod(mCallbacksObj, method_reportGeofenceAddStatus, geofence_id, status);\n    checkAndClearExceptionFromCallback(env, __FUNCTION__);\n};\n\nstatic void gps_geofence_remove_callback(int32_t geofence_id, int32_t status)\n{\n    JNIEnv* env = AndroidRuntime::getJNIEnv();\n    if (status != GPS_GEOFENCE_OPERATION_SUCCESS) {\n        ALOGE(\"Error in geofence_remove_callback: %d\\n\", status);\n    }\n    env->CallVoidMethod(mCallbacksObj, method_reportGeofenceRemoveStatus, geofence_id, status);\n    checkAndClearExceptionFromCallback(env, __FUNCTION__);\n};\n\nstatic void gps_geofence_resume_callback(int32_t geofence_id, int32_t status)\n{\n    JNIEnv* env = AndroidRuntime::getJNIEnv();\n    if (status != GPS_GEOFENCE_OPERATION_SUCCESS) {\n        ALOGE(\"Error in geofence_resume_callback: %d\\n\", status);\n    }\n    env->CallVoidMethod(mCallbacksObj, method_reportGeofenceResumeStatus, geofence_id, status);\n    checkAndClearExceptionFromCallback(env, __FUNCTION__);\n};\n\nstatic void gps_geofence_pause_callback(int32_t geofence_id, int32_t status)\n{\n    JNIEnv* env = AndroidRuntime::getJNIEnv();\n    if (status != GPS_GEOFENCE_OPERATION_SUCCESS) {\n        ALOGE(\"Error in geofence_pause_callback: %d\\n\", status);\n    }\n    env->CallVoidMethod(mCallbacksObj, method_reportGeofencePauseStatus, geofence_id, status);\n    checkAndClearExceptionFromCallback(env, __FUNCTION__);\n};\n\nGpsGeofenceCallbacks sGpsGeofenceCallbacks = {\n    gps_geofence_transition_callback,\n    gps_geofence_status_callback,\n    gps_geofence_add_callback,\n    gps_geofence_remove_callback,\n    gps_geofence_pause_callback,\n    gps_geofence_resume_callback,\n    create_thread_callback,\n};\n\nstatic void android_location_GpsLocationProvider_class_init_native(JNIEnv* env, jclass clazz) {\n    int err;\n    hw_module_t* module;\n\n    method_reportLocation = env->GetMethodID(clazz, \"reportLocation\", \"(IDDDFFFJ)V\");\n    method_reportStatus = env->GetMethodID(clazz, \"reportStatus\", \"(I)V\");\n    method_reportSvStatus = env->GetMethodID(clazz, \"reportSvStatus\", \"()V\");\n    method_reportAGpsStatus = env->GetMethodID(clazz, \"reportAGpsStatus\", \"(II[B)V\");\n    method_reportNmea = env->GetMethodID(clazz, \"reportNmea\", \"(J)V\");\n    method_setEngineCapabilities = env->GetMethodID(clazz, \"setEngineCapabilities\", \"(I)V\");\n    method_xtraDownloadRequest = env->GetMethodID(clazz, \"xtraDownloadRequest\", \"()V\");\n    method_reportNiNotification = env->GetMethodID(clazz, \"reportNiNotification\",\n            \"(IIIIILjava/lang/String;Ljava/lang/String;IILjava/lang/String;)V\");\n    method_requestRefLocation = env->GetMethodID(clazz,\"requestRefLocation\",\"(I)V\");\n    method_requestSetID = env->GetMethodID(clazz,\"requestSetID\",\"(I)V\");\n    method_requestUtcTime = env->GetMethodID(clazz,\"requestUtcTime\",\"()V\");\n    method_reportGeofenceTransition = env->GetMethodID(clazz,\"reportGeofenceTransition\",\n            \"(IIDDDFFFJIJ)V\");\n    method_reportGeofenceStatus = env->GetMethodID(clazz,\"reportGeofenceStatus\",\n            \"(IIDDDFFFJ)V\");\n    method_reportGeofenceAddStatus = env->GetMethodID(clazz,\"reportGeofenceAddStatus\",\n            \"(II)V\");\n    method_reportGeofenceRemoveStatus = env->GetMethodID(clazz,\"reportGeofenceRemoveStatus\",\n            \"(II)V\");\n    method_reportGeofenceResumeStatus = env->GetMethodID(clazz,\"reportGeofenceResumeStatus\",\n            \"(II)V\");\n    method_reportGeofencePauseStatus = env->GetMethodID(clazz,\"reportGeofencePauseStatus\",\n            \"(II)V\");\n    method_reportMeasurementData = env->GetMethodID(\n            clazz,\n            \"reportMeasurementData\",\n            \"(Landroid/location/GpsMeasurementsEvent;)V\");\n    method_reportNavigationMessages = env->GetMethodID(\n            clazz,\n            \"reportNavigationMessage\",\n            \"(Landroid/location/GpsNavigationMessageEvent;)V\");\n\n    err = hw_get_module(GPS_HARDWARE_MODULE_ID, (hw_module_t const**)&module);\n    if (err == 0) {\n        hw_device_t* device;\n        err = module->methods->open(module, GPS_HARDWARE_MODULE_ID, &device);\n        if (err == 0) {\n            gps_device_t* gps_device = (gps_device_t *)device;\n            sGpsInterface = gps_device->get_gps_interface(gps_device);\n        }\n    }\n    if (sGpsInterface) {\n        sGpsXtraInterface =\n            (const GpsXtraInterface*)sGpsInterface->get_extension(GPS_XTRA_INTERFACE);\n        sAGpsInterface =\n            (const AGpsInterface*)sGpsInterface->get_extension(AGPS_INTERFACE);\n        sGpsNiInterface =\n            (const GpsNiInterface*)sGpsInterface->get_extension(GPS_NI_INTERFACE);\n        sGpsDebugInterface =\n            (const GpsDebugInterface*)sGpsInterface->get_extension(GPS_DEBUG_INTERFACE);\n        sAGpsRilInterface =\n            (const AGpsRilInterface*)sGpsInterface->get_extension(AGPS_RIL_INTERFACE);\n        sGpsGeofencingInterface =\n            (const GpsGeofencingInterface*)sGpsInterface->get_extension(GPS_GEOFENCING_INTERFACE);\n        sGpsMeasurementInterface =\n            (const GpsMeasurementInterface*)sGpsInterface->get_extension(GPS_MEASUREMENT_INTERFACE);\n        sGpsNavigationMessageInterface =\n            (const GpsNavigationMessageInterface*)sGpsInterface->get_extension(\n                    GPS_NAVIGATION_MESSAGE_INTERFACE);\n        sGnssConfigurationInterface =\n            (const GnssConfigurationInterface*)sGpsInterface->get_extension(\n                    GNSS_CONFIGURATION_INTERFACE);\n    }\n}\n\nstatic jboolean android_location_GpsLocationProvider_is_supported(\n        JNIEnv* /* env */, jclass /* clazz */)\n{\n    return (sGpsInterface != NULL) ?  JNI_TRUE : JNI_FALSE;\n}\n\nstatic jboolean android_location_GpsLocationProvider_is_agps_ril_supported(\n        JNIEnv* /* env */, jclass /* clazz */)\n{\n    return (sAGpsRilInterface != NULL) ? JNI_TRUE : JNI_FALSE;\n}\n\nstatic jboolean android_location_gpsLocationProvider_is_gnss_configuration_supported(\n        JNIEnv* /* env */, jclass /* jclazz */)\n{\n    return (sGnssConfigurationInterface != NULL) ? JNI_TRUE : JNI_FALSE;\n}\n\nstatic jboolean android_location_GpsLocationProvider_init(JNIEnv* env, jobject obj)\n{\n    // this must be set before calling into the HAL library\n    if (!mCallbacksObj)\n        mCallbacksObj = env->NewGlobalRef(obj);\n\n    // fail if the main interface fails to initialize\n    if (!sGpsInterface || sGpsInterface->init(&sGpsCallbacks) != 0)\n        return JNI_FALSE;\n\n    // if XTRA initialization fails we will disable it by sGpsXtraInterface to NULL,\n    // but continue to allow the rest of the GPS interface to work.\n    if (sGpsXtraInterface && sGpsXtraInterface->init(&sGpsXtraCallbacks) != 0)\n        sGpsXtraInterface = NULL;\n    if (sAGpsInterface)\n        sAGpsInterface->init(&sAGpsCallbacks);\n    if (sGpsNiInterface)\n        sGpsNiInterface->init(&sGpsNiCallbacks);\n    if (sAGpsRilInterface)\n        sAGpsRilInterface->init(&sAGpsRilCallbacks);\n    if (sGpsGeofencingInterface)\n        sGpsGeofencingInterface->init(&sGpsGeofenceCallbacks);\n\n    return JNI_TRUE;\n}\n\nstatic void android_location_GpsLocationProvider_cleanup(JNIEnv* /* env */, jobject /* obj */)\n{\n    if (sGpsInterface)\n        sGpsInterface->cleanup();\n}\n\nstatic jboolean android_location_GpsLocationProvider_set_position_mode(JNIEnv* /* env */,\n        jobject /* obj */, jint mode, jint recurrence, jint min_interval, jint preferred_accuracy,\n        jint preferred_time)\n{\n    if (sGpsInterface) {\n        if (sGpsInterface->set_position_mode(mode, recurrence, min_interval, preferred_accuracy,\n                preferred_time) == 0) {\n            return JNI_TRUE;\n        } else {\n            return JNI_FALSE;\n        }\n    }\n    else\n        return JNI_FALSE;\n}\n\nstatic jboolean android_location_GpsLocationProvider_start(JNIEnv* /* env */, jobject /* obj */)\n{\n    if (sGpsInterface) {\n        if (sGpsInterface->start() == 0) {\n            return JNI_TRUE;\n        } else {\n            return JNI_FALSE;\n        }\n    }\n    else\n        return JNI_FALSE;\n}\n\nstatic jboolean android_location_GpsLocationProvider_stop(JNIEnv* /* env */, jobject /* obj */)\n{\n    if (sGpsInterface) {\n        if (sGpsInterface->stop() == 0) {\n            return JNI_TRUE;\n        } else {\n            return JNI_FALSE;\n        }\n    }\n    else\n        return JNI_FALSE;\n}\n\nstatic void android_location_GpsLocationProvider_delete_aiding_data(JNIEnv* /* env */,\n                                                                    jobject /* obj */,\n                                                                    jint flags)\n{\n    if (sGpsInterface)\n        sGpsInterface->delete_aiding_data(flags);\n}\n\nstatic jint android_location_GpsLocationProvider_read_sv_status(JNIEnv* env, jobject /* obj */,\n        jintArray prnArray, jfloatArray snrArray, jfloatArray elevArray, jfloatArray azumArray,\n        jintArray maskArray)\n{\n    // this should only be called from within a call to reportSvStatus\n\n    jint* prns = env->GetIntArrayElements(prnArray, 0);\n    jfloat* snrs = env->GetFloatArrayElements(snrArray, 0);\n    jfloat* elev = env->GetFloatArrayElements(elevArray, 0);\n    jfloat* azim = env->GetFloatArrayElements(azumArray, 0);\n    jint* mask = env->GetIntArrayElements(maskArray, 0);\n\n    int num_svs = sGpsSvStatus.num_svs;\n    for (int i = 0; i < num_svs; i++) {\n        prns[i] = sGpsSvStatus.sv_list[i].prn;\n        snrs[i] = sGpsSvStatus.sv_list[i].snr;\n        elev[i] = sGpsSvStatus.sv_list[i].elevation;\n        azim[i] = sGpsSvStatus.sv_list[i].azimuth;\n    }\n    mask[0] = sGpsSvStatus.ephemeris_mask;\n    mask[1] = sGpsSvStatus.almanac_mask;\n    mask[2] = sGpsSvStatus.used_in_fix_mask;\n\n    env->ReleaseIntArrayElements(prnArray, prns, 0);\n    env->ReleaseFloatArrayElements(snrArray, snrs, 0);\n    env->ReleaseFloatArrayElements(elevArray, elev, 0);\n    env->ReleaseFloatArrayElements(azumArray, azim, 0);\n    env->ReleaseIntArrayElements(maskArray, mask, 0);\n    return (jint) num_svs;\n}\n\nstatic void android_location_GpsLocationProvider_agps_set_reference_location_cellid(\n        JNIEnv* /* env */, jobject /* obj */, jint type, jint mcc, jint mnc, jint lac, jint cid, jint psc)\n{\n    AGpsRefLocation location;\n\n    if (!sAGpsRilInterface) {\n        ALOGE(\"no AGPS RIL interface in agps_set_reference_location_cellid\");\n        return;\n    }\n\n    switch(type) {\n        case AGPS_REF_LOCATION_TYPE_GSM_CELLID:\n        case AGPS_REF_LOCATION_TYPE_UMTS_CELLID:\n            location.type = type;\n            location.u.cellID.mcc = mcc;\n            location.u.cellID.mnc = mnc;\n            location.u.cellID.lac = lac;\n#ifdef AGPS_USE_PSC\n            location.u.cellID.psc = psc;\n#else\n            (void)psc;\n#endif\n            location.u.cellID.cid = cid;\n            break;\n        default:\n            ALOGE(\"Neither a GSM nor a UMTS cellid (%s:%d).\",__FUNCTION__,__LINE__);\n            return;\n            break;\n    }\n    sAGpsRilInterface->set_ref_location(&location, sizeof(location));\n}\n\nstatic void android_location_GpsLocationProvider_agps_send_ni_message(JNIEnv* env,\n        jobject /* obj */, jbyteArray ni_msg, jint size)\n{\n    size_t sz;\n\n    if (!sAGpsRilInterface) {\n        ALOGE(\"no AGPS RIL interface in send_ni_message\");\n        return;\n    }\n    if (size < 0)\n        return;\n    sz = (size_t)size;\n    jbyte* b = env->GetByteArrayElements(ni_msg, 0);\n    sAGpsRilInterface->ni_message((uint8_t *)b,sz);\n    env->ReleaseByteArrayElements(ni_msg,b,0);\n}\n\nstatic void android_location_GpsLocationProvider_agps_set_id(JNIEnv *env, jobject /* obj */,\n                                                             jint type, jstring  setid_string)\n{\n    if (!sAGpsRilInterface) {\n        ALOGE(\"no AGPS RIL interface in agps_set_id\");\n        return;\n    }\n\n    const char *setid = env->GetStringUTFChars(setid_string, NULL);\n    sAGpsRilInterface->set_set_id(type, setid);\n    env->ReleaseStringUTFChars(setid_string, setid);\n}\n\nstatic jint android_location_GpsLocationProvider_read_nmea(JNIEnv* env, jobject /* obj */,\n                                            jbyteArray nmeaArray, jint buffer_size)\n{\n    // this should only be called from within a call to reportNmea\n    jbyte* nmea = (jbyte *)env->GetPrimitiveArrayCritical(nmeaArray, 0);\n    int length = sNmeaStringLength;\n    if (length > buffer_size)\n        length = buffer_size;\n    memcpy(nmea, sNmeaString, length);\n    env->ReleasePrimitiveArrayCritical(nmeaArray, nmea, JNI_ABORT);\n    return (jint) length;\n}\n\nstatic void android_location_GpsLocationProvider_inject_time(JNIEnv* /* env */, jobject /* obj */,\n        jlong time, jlong timeReference, jint uncertainty)\n{\n    if (sGpsInterface)\n        sGpsInterface->inject_time(time, timeReference, uncertainty);\n}\n\nstatic void android_location_GpsLocationProvider_inject_location(JNIEnv* /* env */,\n        jobject /* obj */, jdouble latitude, jdouble longitude, jfloat accuracy)\n{\n    if (sGpsInterface)\n        sGpsInterface->inject_location(latitude, longitude, accuracy);\n}\n\nstatic jboolean android_location_GpsLocationProvider_supports_xtra(\n        JNIEnv* /* env */, jobject /* obj */)\n{\n    return (sGpsXtraInterface != NULL) ? JNI_TRUE : JNI_FALSE;\n}\n\nstatic void android_location_GpsLocationProvider_inject_xtra_data(JNIEnv* env, jobject /* obj */,\n        jbyteArray data, jint length)\n{\n    if (!sGpsXtraInterface) {\n        ALOGE(\"no XTRA interface in inject_xtra_data\");\n        return;\n    }\n\n    jbyte* bytes = (jbyte *)env->GetPrimitiveArrayCritical(data, 0);\n    sGpsXtraInterface->inject_xtra_data((char *)bytes, length);\n    env->ReleasePrimitiveArrayCritical(data, bytes, JNI_ABORT);\n}\n\nstatic void android_location_GpsLocationProvider_agps_data_conn_open(\n        JNIEnv* env, jobject /* obj */, jstring apn, jint apnIpType)\n{\n    if (!sAGpsInterface) {\n        ALOGE(\"no AGPS interface in agps_data_conn_open\");\n        return;\n    }\n    if (apn == NULL) {\n        jniThrowException(env, \"java/lang/IllegalArgumentException\", NULL);\n        return;\n    }\n\n    const char *apnStr = env->GetStringUTFChars(apn, NULL);\n\n    size_t interface_size = sAGpsInterface->size;\n    if (interface_size == sizeof(AGpsInterface_v2)) {\n        sAGpsInterface->data_conn_open_with_apn_ip_type(apnStr, apnIpType);\n    } else if (interface_size == sizeof(AGpsInterface_v1)) {\n        sAGpsInterface->data_conn_open(apnStr);\n    } else {\n        ALOGE(\"Invalid size of AGpsInterface found: %zd.\", interface_size);\n    }\n\n    env->ReleaseStringUTFChars(apn, apnStr);\n}\n\nstatic void android_location_GpsLocationProvider_agps_data_conn_closed(JNIEnv* /* env */,\n                                                                       jobject /* obj */)\n{\n    if (!sAGpsInterface) {\n        ALOGE(\"no AGPS interface in agps_data_conn_closed\");\n        return;\n    }\n    sAGpsInterface->data_conn_closed();\n}\n\nstatic void android_location_GpsLocationProvider_agps_data_conn_failed(JNIEnv* /* env */,\n                                                                       jobject /* obj */)\n{\n    if (!sAGpsInterface) {\n        ALOGE(\"no AGPS interface in agps_data_conn_failed\");\n        return;\n    }\n    sAGpsInterface->data_conn_failed();\n}\n\nstatic void android_location_GpsLocationProvider_set_agps_server(JNIEnv* env, jobject /* obj */,\n        jint type, jstring hostname, jint port)\n{\n    if (!sAGpsInterface) {\n        ALOGE(\"no AGPS interface in set_agps_server\");\n        return;\n    }\n    const char *c_hostname = env->GetStringUTFChars(hostname, NULL);\n    sAGpsInterface->set_server(type, c_hostname, port);\n    env->ReleaseStringUTFChars(hostname, c_hostname);\n}\n\nstatic void android_location_GpsLocationProvider_send_ni_response(JNIEnv* /* env */,\n      jobject /* obj */, jint notifId, jint response)\n{\n    if (!sGpsNiInterface) {\n        ALOGE(\"no NI interface in send_ni_response\");\n        return;\n    }\n\n    sGpsNiInterface->respond(notifId, response);\n}\n\nstatic jstring android_location_GpsLocationProvider_get_internal_state(JNIEnv* env,\n                                                                       jobject /* obj */) {\n    jstring result = NULL;\n    if (sGpsDebugInterface) {\n        const size_t maxLength = 2047;\n        char buffer[maxLength+1];\n        size_t length = sGpsDebugInterface->get_internal_state(buffer, maxLength);\n        if (length > maxLength) length = maxLength;\n        buffer[length] = 0;\n        result = env->NewStringUTF(buffer);\n    }\n    return result;\n}\n\nstatic void android_location_GpsLocationProvider_update_network_state(JNIEnv* env, jobject /* obj */,\n        jboolean connected, jint type, jboolean roaming, jboolean available, jstring extraInfo, jstring apn)\n{\n\n    if (sAGpsRilInterface && sAGpsRilInterface->update_network_state) {\n        if (extraInfo) {\n            const char *extraInfoStr = env->GetStringUTFChars(extraInfo, NULL);\n            sAGpsRilInterface->update_network_state(connected, type, roaming, extraInfoStr);\n            env->ReleaseStringUTFChars(extraInfo, extraInfoStr);\n        } else {\n            sAGpsRilInterface->update_network_state(connected, type, roaming, NULL);\n        }\n\n        // update_network_availability callback was not included in original AGpsRilInterface\n        if (sAGpsRilInterface->size >= sizeof(AGpsRilInterface)\n                && sAGpsRilInterface->update_network_availability) {\n            const char *c_apn = env->GetStringUTFChars(apn, NULL);\n            sAGpsRilInterface->update_network_availability(available, c_apn);\n            env->ReleaseStringUTFChars(apn, c_apn);\n        }\n    }\n}\n\nstatic jboolean android_location_GpsLocationProvider_is_geofence_supported(\n        JNIEnv* /* env */, jobject /* obj */)\n{\n    return (sGpsGeofencingInterface != NULL) ? JNI_TRUE : JNI_FALSE;\n}\n\nstatic jboolean android_location_GpsLocationProvider_add_geofence(JNIEnv* /* env */,\n        jobject /* obj */, jint geofence_id, jdouble latitude, jdouble longitude, jdouble radius,\n        jint last_transition, jint monitor_transition, jint notification_responsiveness,\n        jint unknown_timer) {\n    if (sGpsGeofencingInterface != NULL) {\n        sGpsGeofencingInterface->add_geofence_area(geofence_id, latitude, longitude,\n                radius, last_transition, monitor_transition, notification_responsiveness,\n                unknown_timer);\n        return JNI_TRUE;\n    } else {\n        ALOGE(\"Geofence interface not available\");\n    }\n    return JNI_FALSE;\n}\n\nstatic jboolean android_location_GpsLocationProvider_remove_geofence(JNIEnv* /* env */,\n        jobject /* obj */, jint geofence_id) {\n    if (sGpsGeofencingInterface != NULL) {\n        sGpsGeofencingInterface->remove_geofence_area(geofence_id);\n        return JNI_TRUE;\n    } else {\n        ALOGE(\"Geofence interface not available\");\n    }\n    return JNI_FALSE;\n}\n\nstatic jboolean android_location_GpsLocationProvider_pause_geofence(JNIEnv* /* env */,\n        jobject /* obj */, jint geofence_id) {\n    if (sGpsGeofencingInterface != NULL) {\n        sGpsGeofencingInterface->pause_geofence(geofence_id);\n        return JNI_TRUE;\n    } else {\n        ALOGE(\"Geofence interface not available\");\n    }\n    return JNI_FALSE;\n}\n\nstatic jboolean android_location_GpsLocationProvider_resume_geofence(JNIEnv* /* env */,\n        jobject /* obj */, jint geofence_id, jint monitor_transition) {\n    if (sGpsGeofencingInterface != NULL) {\n        sGpsGeofencingInterface->resume_geofence(geofence_id, monitor_transition);\n        return JNI_TRUE;\n    } else {\n        ALOGE(\"Geofence interface not available\");\n    }\n    return JNI_FALSE;\n}\n\nstatic jobject translate_gps_clock(JNIEnv* env, GpsClock* clock) {\n    const char* doubleSignature = \"(D)V\";\n    const char* longSignature = \"(J)V\";\n\n    jclass gpsClockClass = env->FindClass(\"android/location/GpsClock\");\n    jmethodID gpsClockCtor = env->GetMethodID(gpsClockClass, \"<init>\", \"()V\");\n\n    jobject gpsClockObject = env->NewObject(gpsClockClass, gpsClockCtor);\n    GpsClockFlags flags = clock->flags;\n\n    if (flags & GPS_CLOCK_HAS_LEAP_SECOND) {\n        jmethodID setterMethod = env->GetMethodID(gpsClockClass, \"setLeapSecond\", \"(S)V\");\n        env->CallVoidMethod(gpsClockObject, setterMethod, clock->leap_second);\n   }\n\n   jmethodID typeSetterMethod = env->GetMethodID(gpsClockClass, \"setType\", \"(B)V\");\n   env->CallVoidMethod(gpsClockObject, typeSetterMethod, clock->type);\n\n    jmethodID setterMethod = env->GetMethodID(gpsClockClass, \"setTimeInNs\", longSignature);\n    env->CallVoidMethod(gpsClockObject, setterMethod, clock->time_ns);\n\n    if (flags & GPS_CLOCK_HAS_TIME_UNCERTAINTY) {\n        jmethodID setterMethod =\n                env->GetMethodID(gpsClockClass, \"setTimeUncertaintyInNs\", doubleSignature);\n        env->CallVoidMethod(gpsClockObject, setterMethod, clock->time_uncertainty_ns);\n    }\n\n    if (flags & GPS_CLOCK_HAS_FULL_BIAS) {\n        jmethodID setterMethod = env->GetMethodID(gpsClockClass, \"setFullBiasInNs\", longSignature);\n        env->CallVoidMethod(gpsClockObject, setterMethod, clock->full_bias_ns);\n    }\n\n    if (flags & GPS_CLOCK_HAS_BIAS) {\n        jmethodID setterMethod = env->GetMethodID(gpsClockClass, \"setBiasInNs\", doubleSignature);\n        env->CallVoidMethod(gpsClockObject, setterMethod, clock->bias_ns);\n    }\n\n    if (flags & GPS_CLOCK_HAS_BIAS_UNCERTAINTY) {\n        jmethodID setterMethod =\n                env->GetMethodID(gpsClockClass, \"setBiasUncertaintyInNs\", doubleSignature);\n        env->CallVoidMethod(gpsClockObject, setterMethod, clock->bias_uncertainty_ns);\n    }\n\n    if (flags & GPS_CLOCK_HAS_DRIFT) {\n        jmethodID setterMethod =\n                env->GetMethodID(gpsClockClass, \"setDriftInNsPerSec\", doubleSignature);\n        env->CallVoidMethod(gpsClockObject, setterMethod, clock->drift_nsps);\n    }\n\n    if (flags & GPS_CLOCK_HAS_DRIFT_UNCERTAINTY) {\n        jmethodID setterMethod =\n                env->GetMethodID(gpsClockClass, \"setDriftUncertaintyInNsPerSec\", doubleSignature);\n        env->CallVoidMethod(gpsClockObject, setterMethod, clock->drift_uncertainty_nsps);\n    }\n\n    env->DeleteLocalRef(gpsClockClass);\n    return gpsClockObject;\n}\n\nstatic jobject translate_gps_measurement(JNIEnv* env, GpsMeasurement* measurement) {\n    const char* byteSignature = \"(B)V\";\n    const char* shortSignature = \"(S)V\";\n    const char* intSignature = \"(I)V\";\n    const char* longSignature = \"(J)V\";\n    const char* floatSignature = \"(F)V\";\n    const char* doubleSignature = \"(D)V\";\n\n    jclass gpsMeasurementClass = env->FindClass(\"android/location/GpsMeasurement\");\n    jmethodID gpsMeasurementCtor = env->GetMethodID(gpsMeasurementClass, \"<init>\", \"()V\");\n\n    jobject gpsMeasurementObject = env->NewObject(gpsMeasurementClass, gpsMeasurementCtor);\n    GpsMeasurementFlags flags = measurement->flags;\n\n    jmethodID prnSetterMethod = env->GetMethodID(gpsMeasurementClass, \"setPrn\", byteSignature);\n    env->CallVoidMethod(gpsMeasurementObject, prnSetterMethod, measurement->prn);\n\n    jmethodID timeOffsetSetterMethod =\n            env->GetMethodID(gpsMeasurementClass, \"setTimeOffsetInNs\", doubleSignature);\n    env->CallVoidMethod(\n            gpsMeasurementObject,\n            timeOffsetSetterMethod,\n            measurement->time_offset_ns);\n\n    jmethodID stateSetterMethod = env->GetMethodID(gpsMeasurementClass, \"setState\", shortSignature);\n    env->CallVoidMethod(gpsMeasurementObject, stateSetterMethod, measurement->state);\n\n    jmethodID receivedGpsTowSetterMethod =\n            env->GetMethodID(gpsMeasurementClass, \"setReceivedGpsTowInNs\", longSignature);\n    env->CallVoidMethod(\n            gpsMeasurementObject,\n            receivedGpsTowSetterMethod,\n            measurement->received_gps_tow_ns);\n\n    jmethodID receivedGpsTowUncertaintySetterMethod = env->GetMethodID(\n            gpsMeasurementClass,\n            \"setReceivedGpsTowUncertaintyInNs\",\n            longSignature);\n    env->CallVoidMethod(\n            gpsMeasurementObject,\n            receivedGpsTowUncertaintySetterMethod,\n            measurement->received_gps_tow_uncertainty_ns);\n\n    jmethodID cn0SetterMethod =\n            env->GetMethodID(gpsMeasurementClass, \"setCn0InDbHz\", doubleSignature);\n    env->CallVoidMethod(gpsMeasurementObject, cn0SetterMethod, measurement->c_n0_dbhz);\n\n    jmethodID pseudorangeRateSetterMethod = env->GetMethodID(\n            gpsMeasurementClass,\n            \"setPseudorangeRateInMetersPerSec\",\n            doubleSignature);\n    env->CallVoidMethod(\n            gpsMeasurementObject,\n            pseudorangeRateSetterMethod,\n            measurement->pseudorange_rate_mps);\n\n    jmethodID pseudorangeRateUncertaintySetterMethod = env->GetMethodID(\n            gpsMeasurementClass,\n            \"setPseudorangeRateUncertaintyInMetersPerSec\",\n            doubleSignature);\n    env->CallVoidMethod(\n            gpsMeasurementObject,\n            pseudorangeRateUncertaintySetterMethod,\n            measurement->pseudorange_rate_uncertainty_mps);\n\n    jmethodID accumulatedDeltaRangeStateSetterMethod =\n            env->GetMethodID(gpsMeasurementClass, \"setAccumulatedDeltaRangeState\", shortSignature);\n    env->CallVoidMethod(\n            gpsMeasurementObject,\n            accumulatedDeltaRangeStateSetterMethod,\n            measurement->accumulated_delta_range_state);\n\n    jmethodID accumulatedDeltaRangeSetterMethod = env->GetMethodID(\n            gpsMeasurementClass,\n            \"setAccumulatedDeltaRangeInMeters\",\n            doubleSignature);\n    env->CallVoidMethod(\n            gpsMeasurementObject,\n            accumulatedDeltaRangeSetterMethod,\n            measurement->accumulated_delta_range_m);\n\n    jmethodID accumulatedDeltaRangeUncertaintySetterMethod = env->GetMethodID(\n            gpsMeasurementClass,\n            \"setAccumulatedDeltaRangeUncertaintyInMeters\",\n            doubleSignature);\n    env->CallVoidMethod(\n            gpsMeasurementObject,\n            accumulatedDeltaRangeUncertaintySetterMethod,\n            measurement->accumulated_delta_range_uncertainty_m);\n\n    if (flags & GPS_MEASUREMENT_HAS_PSEUDORANGE) {\n        jmethodID setterMethod =\n                env->GetMethodID(gpsMeasurementClass, \"setPseudorangeInMeters\", doubleSignature);\n        env->CallVoidMethod(gpsMeasurementObject, setterMethod, measurement->pseudorange_m);\n    }\n\n    if (flags & GPS_MEASUREMENT_HAS_PSEUDORANGE_UNCERTAINTY) {\n        jmethodID setterMethod = env->GetMethodID(\n                gpsMeasurementClass,\n                \"setPseudorangeUncertaintyInMeters\",\n                doubleSignature);\n        env->CallVoidMethod(\n                gpsMeasurementObject,\n                setterMethod,\n                measurement->pseudorange_uncertainty_m);\n    }\n\n    if (flags & GPS_MEASUREMENT_HAS_CODE_PHASE) {\n        jmethodID setterMethod =\n                env->GetMethodID(gpsMeasurementClass, \"setCodePhaseInChips\", doubleSignature);\n        env->CallVoidMethod(gpsMeasurementObject, setterMethod, measurement->code_phase_chips);\n    }\n\n    if (flags & GPS_MEASUREMENT_HAS_CODE_PHASE_UNCERTAINTY) {\n        jmethodID setterMethod = env->GetMethodID(\n                gpsMeasurementClass,\n                \"setCodePhaseUncertaintyInChips\",\n                doubleSignature);\n        env->CallVoidMethod(\n                gpsMeasurementObject,\n                setterMethod,\n                measurement->code_phase_uncertainty_chips);\n    }\n\n    if (flags & GPS_MEASUREMENT_HAS_CARRIER_FREQUENCY) {\n        jmethodID setterMethod =\n                env->GetMethodID(gpsMeasurementClass, \"setCarrierFrequencyInHz\", floatSignature);\n        env->CallVoidMethod(\n                gpsMeasurementObject,\n                setterMethod,\n                measurement->carrier_frequency_hz);\n    }\n\n    if (flags & GPS_MEASUREMENT_HAS_CARRIER_CYCLES) {\n        jmethodID setterMethod =\n                env->GetMethodID(gpsMeasurementClass, \"setCarrierCycles\", longSignature);\n        env->CallVoidMethod(gpsMeasurementObject, setterMethod, measurement->carrier_cycles);\n    }\n\n    if (flags & GPS_MEASUREMENT_HAS_CARRIER_PHASE) {\n        jmethodID setterMethod =\n                env->GetMethodID(gpsMeasurementClass, \"setCarrierPhase\", doubleSignature);\n        env->CallVoidMethod(gpsMeasurementObject, setterMethod, measurement->carrier_phase);\n    }\n\n    if (flags & GPS_MEASUREMENT_HAS_CARRIER_PHASE_UNCERTAINTY) {\n        jmethodID setterMethod = env->GetMethodID(\n                gpsMeasurementClass,\n                \"setCarrierPhaseUncertainty\",\n                doubleSignature);\n        env->CallVoidMethod(\n                gpsMeasurementObject,\n                setterMethod,\n                measurement->carrier_phase_uncertainty);\n    }\n\n    jmethodID lossOfLockSetterMethod =\n            env->GetMethodID(gpsMeasurementClass, \"setLossOfLock\", byteSignature);\n    env->CallVoidMethod(gpsMeasurementObject, lossOfLockSetterMethod, measurement->loss_of_lock);\n\n    if (flags & GPS_MEASUREMENT_HAS_BIT_NUMBER) {\n        jmethodID setterMethod =\n                env->GetMethodID(gpsMeasurementClass, \"setBitNumber\", intSignature);\n        env->CallVoidMethod(gpsMeasurementObject, setterMethod, measurement->bit_number);\n    }\n\n    if (flags & GPS_MEASUREMENT_HAS_TIME_FROM_LAST_BIT) {\n        jmethodID setterMethod =\n                env->GetMethodID(gpsMeasurementClass, \"setTimeFromLastBitInMs\", shortSignature);\n        env->CallVoidMethod(\n                gpsMeasurementObject,\n                setterMethod,\n                measurement->time_from_last_bit_ms);\n    }\n\n    if (flags & GPS_MEASUREMENT_HAS_DOPPLER_SHIFT) {\n        jmethodID setterMethod =\n                env->GetMethodID(gpsMeasurementClass, \"setDopplerShiftInHz\", doubleSignature);\n        env->CallVoidMethod(gpsMeasurementObject, setterMethod, measurement->doppler_shift_hz);\n    }\n\n    if (flags & GPS_MEASUREMENT_HAS_DOPPLER_SHIFT_UNCERTAINTY) {\n        jmethodID setterMethod = env->GetMethodID(\n                gpsMeasurementClass,\n                \"setDopplerShiftUncertaintyInHz\",\n                doubleSignature);\n        env->CallVoidMethod(\n                gpsMeasurementObject,\n                setterMethod,\n                measurement->doppler_shift_uncertainty_hz);\n    }\n\n    jmethodID multipathIndicatorSetterMethod =\n            env->GetMethodID(gpsMeasurementClass, \"setMultipathIndicator\", byteSignature);\n    env->CallVoidMethod(\n            gpsMeasurementObject,\n            multipathIndicatorSetterMethod,\n            measurement->multipath_indicator);\n\n    if (flags & GPS_MEASUREMENT_HAS_SNR) {\n        jmethodID setterMethod =\n                env->GetMethodID(gpsMeasurementClass, \"setSnrInDb\", doubleSignature);\n        env->CallVoidMethod(gpsMeasurementObject, setterMethod, measurement->snr_db);\n    }\n\n    if (flags & GPS_MEASUREMENT_HAS_ELEVATION) {\n        jmethodID setterMethod =\n                env->GetMethodID(gpsMeasurementClass, \"setElevationInDeg\", doubleSignature);\n        env->CallVoidMethod(gpsMeasurementObject, setterMethod, measurement->elevation_deg);\n    }\n\n    if (flags & GPS_MEASUREMENT_HAS_ELEVATION_UNCERTAINTY) {\n        jmethodID setterMethod =\n                env->GetMethodID(gpsMeasurementClass, \"setElevationUncertaintyInDeg\", doubleSignature);\n        env->CallVoidMethod(\n                gpsMeasurementObject,\n                setterMethod,\n                measurement->elevation_uncertainty_deg);\n    }\n\n    if (flags & GPS_MEASUREMENT_HAS_AZIMUTH) {\n        jmethodID setterMethod =\n                env->GetMethodID(gpsMeasurementClass, \"setAzimuthInDeg\", doubleSignature);\n        env->CallVoidMethod(gpsMeasurementObject, setterMethod, measurement->azimuth_deg);\n    }\n\n    if (flags & GPS_MEASUREMENT_HAS_AZIMUTH_UNCERTAINTY) {\n        jmethodID setterMethod = env->GetMethodID(\n                gpsMeasurementClass,\n                \"setAzimuthUncertaintyInDeg\",\n                doubleSignature);\n        env->CallVoidMethod(\n                gpsMeasurementObject,\n                setterMethod,\n                measurement->azimuth_uncertainty_deg);\n    }\n\n    jmethodID usedInFixSetterMethod = env->GetMethodID(gpsMeasurementClass, \"setUsedInFix\", \"(Z)V\");\n    env->CallVoidMethod(\n            gpsMeasurementObject,\n            usedInFixSetterMethod,\n            (flags & GPS_MEASUREMENT_HAS_USED_IN_FIX) && measurement->used_in_fix);\n\n    env->DeleteLocalRef(gpsMeasurementClass);\n    return gpsMeasurementObject;\n}\n\nstatic jobjectArray translate_gps_measurements(JNIEnv* env, GpsData* data) {\n    size_t measurementCount = data->measurement_count;\n    if (measurementCount == 0) {\n        return NULL;\n    }\n\n    jclass gpsMeasurementClass = env->FindClass(\"android/location/GpsMeasurement\");\n    jobjectArray gpsMeasurementArray = env->NewObjectArray(\n            measurementCount,\n            gpsMeasurementClass,\n            NULL /* initialElement */);\n\n    GpsMeasurement* gpsMeasurements = data->measurements;\n    for (uint16_t i = 0; i < measurementCount; ++i) {\n        jobject gpsMeasurement = translate_gps_measurement(env, &gpsMeasurements[i]);\n        env->SetObjectArrayElement(gpsMeasurementArray, i, gpsMeasurement);\n        env->DeleteLocalRef(gpsMeasurement);\n    }\n\n    env->DeleteLocalRef(gpsMeasurementClass);\n    return gpsMeasurementArray;\n}\n\nstatic void measurement_callback(GpsData* data) {\n    JNIEnv* env = AndroidRuntime::getJNIEnv();\n    if (data == NULL) {\n        ALOGE(\"Invalid data provided to gps_measurement_callback\");\n        return;\n    }\n\n    if (data->size == sizeof(GpsData)) {\n        jobject gpsClock = translate_gps_clock(env, &data->clock);\n        jobjectArray measurementArray = translate_gps_measurements(env, data);\n\n        jclass gpsMeasurementsEventClass = env->FindClass(\"android/location/GpsMeasurementsEvent\");\n        jmethodID gpsMeasurementsEventCtor = env->GetMethodID(\n                gpsMeasurementsEventClass,\n                \"<init>\",\n                \"(Landroid/location/GpsClock;[Landroid/location/GpsMeasurement;)V\");\n\n        jobject gpsMeasurementsEvent = env->NewObject(\n                gpsMeasurementsEventClass,\n                gpsMeasurementsEventCtor,\n                gpsClock,\n                measurementArray);\n\n        env->CallVoidMethod(mCallbacksObj, method_reportMeasurementData, gpsMeasurementsEvent);\n        checkAndClearExceptionFromCallback(env, __FUNCTION__);\n\n        env->DeleteLocalRef(gpsClock);\n        env->DeleteLocalRef(measurementArray);\n        env->DeleteLocalRef(gpsMeasurementsEventClass);\n        env->DeleteLocalRef(gpsMeasurementsEvent);\n    } else {\n        ALOGE(\"Invalid GpsData size found in gps_measurement_callback, size=%zd\", data->size);\n    }\n}\n\nGpsMeasurementCallbacks sGpsMeasurementCallbacks = {\n    sizeof(GpsMeasurementCallbacks),\n    measurement_callback,\n};\n\nstatic jboolean android_location_GpsLocationProvider_is_measurement_supported(\n        JNIEnv* env,\n        jclass clazz) {\n    if (sGpsMeasurementInterface != NULL) {\n        return JNI_TRUE;\n    }\n    return JNI_FALSE;\n}\n\nstatic jboolean android_location_GpsLocationProvider_start_measurement_collection(\n        JNIEnv* env,\n        jobject obj) {\n    if (sGpsMeasurementInterface == NULL) {\n        ALOGE(\"Measurement interface is not available.\");\n        return JNI_FALSE;\n    }\n\n    int result = sGpsMeasurementInterface->init(&sGpsMeasurementCallbacks);\n    if (result != GPS_GEOFENCE_OPERATION_SUCCESS) {\n        ALOGE(\"An error has been found on GpsMeasurementInterface::init, status=%d\", result);\n        return JNI_FALSE;\n    }\n\n    return JNI_TRUE;\n}\n\nstatic jboolean android_location_GpsLocationProvider_stop_measurement_collection(\n        JNIEnv* env,\n        jobject obj) {\n    if (sGpsMeasurementInterface == NULL) {\n        ALOGE(\"Measurement interface not available\");\n        return JNI_FALSE;\n    }\n\n    sGpsMeasurementInterface->close();\n    return JNI_TRUE;\n}\n\nstatic jobject translate_gps_navigation_message(JNIEnv* env, GpsNavigationMessage* message) {\n    size_t dataLength = message->data_length;\n    uint8_t* data = message->data;\n    if (dataLength == 0 || data == NULL) {\n        ALOGE(\"Invalid Navigation Message found: data=%p, length=%zd\", data, dataLength);\n        return NULL;\n    }\n\n    jclass navigationMessageClass = env->FindClass(\"android/location/GpsNavigationMessage\");\n    jmethodID navigationMessageCtor = env->GetMethodID(navigationMessageClass, \"<init>\", \"()V\");\n    jobject navigationMessageObject = env->NewObject(navigationMessageClass, navigationMessageCtor);\n\n    jmethodID setTypeMethod = env->GetMethodID(navigationMessageClass, \"setType\", \"(B)V\");\n    env->CallVoidMethod(navigationMessageObject, setTypeMethod, message->type);\n\n    jmethodID setPrnMethod = env->GetMethodID(navigationMessageClass, \"setPrn\", \"(B)V\");\n    env->CallVoidMethod(navigationMessageObject, setPrnMethod, message->prn);\n\n    jmethodID setMessageIdMethod = env->GetMethodID(navigationMessageClass, \"setMessageId\", \"(S)V\");\n    env->CallVoidMethod(navigationMessageObject, setMessageIdMethod, message->message_id);\n\n    jmethodID setSubmessageIdMethod =\n            env->GetMethodID(navigationMessageClass, \"setSubmessageId\", \"(S)V\");\n    env->CallVoidMethod(navigationMessageObject, setSubmessageIdMethod, message->submessage_id);\n\n    jbyteArray dataArray = env->NewByteArray(dataLength);\n    env->SetByteArrayRegion(dataArray, 0, dataLength, (jbyte*) data);\n    jmethodID setDataMethod = env->GetMethodID(navigationMessageClass, \"setData\", \"([B)V\");\n    env->CallVoidMethod(navigationMessageObject, setDataMethod, dataArray);\n\n    env->DeleteLocalRef(navigationMessageClass);\n    env->DeleteLocalRef(dataArray);\n    return navigationMessageObject;\n}\n\nstatic void navigation_message_callback(GpsNavigationMessage* message) {\n    JNIEnv* env = AndroidRuntime::getJNIEnv();\n    if (message == NULL) {\n        ALOGE(\"Invalid Navigation Message provided to callback\");\n        return;\n    }\n\n    if (message->size == sizeof(GpsNavigationMessage)) {\n        jobject navigationMessage = translate_gps_navigation_message(env, message);\n\n        jclass navigationMessageEventClass =\n                env->FindClass(\"android/location/GpsNavigationMessageEvent\");\n        jmethodID navigationMessageEventCtor = env->GetMethodID(\n                navigationMessageEventClass,\n                \"<init>\",\n                \"(Landroid/location/GpsNavigationMessage;)V\");\n        jobject navigationMessageEvent = env->NewObject(\n                navigationMessageEventClass,\n                navigationMessageEventCtor,\n                navigationMessage);\n\n        env->CallVoidMethod(mCallbacksObj, method_reportNavigationMessages, navigationMessageEvent);\n        checkAndClearExceptionFromCallback(env, __FUNCTION__);\n\n        env->DeleteLocalRef(navigationMessage);\n        env->DeleteLocalRef(navigationMessageEventClass);\n        env->DeleteLocalRef(navigationMessageEvent);\n    } else {\n        ALOGE(\"Invalid GpsNavigationMessage size found: %zd\", message->size);\n    }\n}\n\nGpsNavigationMessageCallbacks sGpsNavigationMessageCallbacks = {\n    sizeof(GpsNavigationMessageCallbacks),\n    navigation_message_callback,\n};\n\nstatic jboolean android_location_GpsLocationProvider_is_navigation_message_supported(\n        JNIEnv* env,\n        jclass clazz) {\n    if(sGpsNavigationMessageInterface != NULL) {\n        return JNI_TRUE;\n    }\n    return JNI_FALSE;\n}\n\nstatic jboolean android_location_GpsLocationProvider_start_navigation_message_collection(\n        JNIEnv* env,\n        jobject obj) {\n    if (sGpsNavigationMessageInterface == NULL) {\n        ALOGE(\"Navigation Message interface is not available.\");\n        return JNI_FALSE;\n    }\n\n    int result = sGpsNavigationMessageInterface->init(&sGpsNavigationMessageCallbacks);\n    if (result != GPS_NAVIGATION_MESSAGE_OPERATION_SUCCESS) {\n        ALOGE(\"An error has been found in %s: %d\", __FUNCTION__, result);\n        return JNI_FALSE;\n    }\n\n    return JNI_TRUE;\n}\n\nstatic jboolean android_location_GpsLocationProvider_stop_navigation_message_collection(\n        JNIEnv* env,\n        jobject obj) {\n    if (sGpsNavigationMessageInterface == NULL) {\n        ALOGE(\"Navigation Message interface is not available.\");\n        return JNI_FALSE;\n    }\n\n    sGpsNavigationMessageInterface->close();\n    return JNI_TRUE;\n}\n\nstatic void android_location_GpsLocationProvider_configuration_update(JNIEnv* env, jobject obj,\n        jstring config_content)\n{\n    if (!sGnssConfigurationInterface) {\n        ALOGE(\"no GPS configuration interface in configuraiton_update\");\n        return;\n    }\n    const char *data = env->GetStringUTFChars(config_content, NULL);\n    ALOGD(\"GPS configuration:\\n %s\", data);\n    sGnssConfigurationInterface->configuration_update(\n            data, env->GetStringUTFLength(config_content));\n    env->ReleaseStringUTFChars(config_content, data);\n}\n\nstatic JNINativeMethod sMethods[] = {\n     /* name, signature, funcPtr */\n    {\"class_init_native\", \"()V\", (void *)android_location_GpsLocationProvider_class_init_native},\n    {\"native_is_supported\", \"()Z\", (void*)android_location_GpsLocationProvider_is_supported},\n    {\"native_is_agps_ril_supported\", \"()Z\",\n            (void*)android_location_GpsLocationProvider_is_agps_ril_supported},\n    {\"native_is_gnss_configuration_supported\", \"()Z\",\n            (void*)android_location_gpsLocationProvider_is_gnss_configuration_supported},\n    {\"native_init\", \"()Z\", (void*)android_location_GpsLocationProvider_init},\n    {\"native_cleanup\", \"()V\", (void*)android_location_GpsLocationProvider_cleanup},\n    {\"native_set_position_mode\",\n            \"(IIIII)Z\",\n            (void*)android_location_GpsLocationProvider_set_position_mode},\n    {\"native_start\", \"()Z\", (void*)android_location_GpsLocationProvider_start},\n    {\"native_stop\", \"()Z\", (void*)android_location_GpsLocationProvider_stop},\n    {\"native_delete_aiding_data\",\n            \"(I)V\",\n            (void*)android_location_GpsLocationProvider_delete_aiding_data},\n    {\"native_read_sv_status\",\n            \"([I[F[F[F[I)I\",\n            (void*)android_location_GpsLocationProvider_read_sv_status},\n    {\"native_read_nmea\", \"([BI)I\", (void*)android_location_GpsLocationProvider_read_nmea},\n    {\"native_inject_time\", \"(JJI)V\", (void*)android_location_GpsLocationProvider_inject_time},\n    {\"native_inject_location\",\n            \"(DDF)V\",\n            (void*)android_location_GpsLocationProvider_inject_location},\n    {\"native_supports_xtra\", \"()Z\", (void*)android_location_GpsLocationProvider_supports_xtra},\n    {\"native_inject_xtra_data\",\n            \"([BI)V\",\n            (void*)android_location_GpsLocationProvider_inject_xtra_data},\n    {\"native_agps_data_conn_open\",\n            \"(Ljava/lang/String;I)V\",\n            (void*)android_location_GpsLocationProvider_agps_data_conn_open},\n    {\"native_agps_data_conn_closed\",\n            \"()V\",\n            (void*)android_location_GpsLocationProvider_agps_data_conn_closed},\n    {\"native_agps_data_conn_failed\",\n            \"()V\",\n            (void*)android_location_GpsLocationProvider_agps_data_conn_failed},\n    {\"native_agps_set_id\",\n            \"(ILjava/lang/String;)V\",\n            (void*)android_location_GpsLocationProvider_agps_set_id},\n    {\"native_agps_set_ref_location_cellid\",\n            \"(IIIIII)V\",\n            (void*)android_location_GpsLocationProvider_agps_set_reference_location_cellid},\n    {\"native_set_agps_server\",\n            \"(ILjava/lang/String;I)V\",\n            (void*)android_location_GpsLocationProvider_set_agps_server},\n    {\"native_send_ni_response\",\n            \"(II)V\",\n            (void*)android_location_GpsLocationProvider_send_ni_response},\n    {\"native_agps_ni_message\",\n            \"([BI)V\",\n            (void *)android_location_GpsLocationProvider_agps_send_ni_message},\n    {\"native_get_internal_state\",\n            \"()Ljava/lang/String;\",\n            (void*)android_location_GpsLocationProvider_get_internal_state},\n    {\"native_update_network_state\",\n            \"(ZIZZLjava/lang/String;Ljava/lang/String;)V\",\n            (void*)android_location_GpsLocationProvider_update_network_state },\n    {\"native_is_geofence_supported\",\n            \"()Z\",\n            (void*) android_location_GpsLocationProvider_is_geofence_supported},\n    {\"native_add_geofence\",\n            \"(IDDDIIII)Z\",\n            (void *)android_location_GpsLocationProvider_add_geofence},\n    {\"native_remove_geofence\",\n            \"(I)Z\",\n            (void *)android_location_GpsLocationProvider_remove_geofence},\n    {\"native_pause_geofence\", \"(I)Z\", (void *)android_location_GpsLocationProvider_pause_geofence},\n    {\"native_resume_geofence\",\n            \"(II)Z\",\n            (void *)android_location_GpsLocationProvider_resume_geofence},\n    {\"native_is_measurement_supported\",\n            \"()Z\",\n            (void*) android_location_GpsLocationProvider_is_measurement_supported},\n    {\"native_start_measurement_collection\",\n            \"()Z\",\n            (void*) android_location_GpsLocationProvider_start_measurement_collection},\n    {\"native_stop_measurement_collection\",\n            \"()Z\",\n            (void*) android_location_GpsLocationProvider_stop_measurement_collection},\n    {\"native_is_navigation_message_supported\",\n            \"()Z\",\n            (void*) android_location_GpsLocationProvider_is_navigation_message_supported},\n    {\"native_start_navigation_message_collection\",\n            \"()Z\",\n            (void*) android_location_GpsLocationProvider_start_navigation_message_collection},\n    {\"native_stop_navigation_message_collection\",\n            \"()Z\",\n            (void*) android_location_GpsLocationProvider_stop_navigation_message_collection},\n    {\"native_configuration_update\",\n            \"(Ljava/lang/String;)V\",\n            (void*)android_location_GpsLocationProvider_configuration_update},\n};\n\nint register_android_server_location_GpsLocationProvider(JNIEnv* env)\n{\n    return jniRegisterNativeMethods(\n            env,\n            \"com/android/server/location/GpsLocationProvider\",\n            sMethods,\n            NELEM(sMethods));\n}\n\n} /* namespace android */\n"
  },
  {
    "path": "VirtualPosition/vp_APP/VirtualPosition/Android.mk",
    "content": "LOCAL_PATH:= $(call my-dir)\ninclude $(CLEAR_VARS)\nLOCAL_MODULE_TAGS := optional\nLOCAL_SRC_FILES := $(call all-subdir-java-files)\nLOCAL_PACKAGE_NAME := VirtualPosition\ninclude $(BUILD_PACKAGE)\n"
  },
  {
    "path": "VirtualPosition/vp_APP/VirtualPosition/AndroidManifest.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<manifest xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    package=\"com.example.phdemo.myapplication\">\n\n    <application\n        android:allowBackup=\"true\"\n        android:icon=\"@mipmap/ic_launcher\"\n        android:label=\"@string/app_name\"\n        android:supportsRtl=\"true\">\n        <activity android:name=\".MainActivity\">\n            <intent-filter>\n                <action android:name=\"android.intent.action.MAIN\" />\n\n                <category android:name=\"android.intent.category.LAUNCHER\" />\n            </intent-filter>\n        </activity>\n    </application>\n\n</manifest>\n"
  },
  {
    "path": "VirtualPosition/vp_APP/VirtualPosition/java/com/example/phdemo/myapplication/MainActivity.java",
    "content": "package com.example.phdemo.myapplication;\r\n\r\nimport android.os.RemoteException;\r\nimport android.app.Activity;\r\nimport android.os.ServiceManager;\r\nimport android.os.Bundle;\r\nimport android.widget.CompoundButton;\r\nimport android.os.IVirtualPositionService;\r\nimport android.os.RemoteException;\r\nimport android.util.Log;\r\nimport android.view.View;\r\nimport android.view.View.OnClickListener;\r\nimport android.widget.Button;\r\nimport android.widget.EditText;\r\nimport android.widget.ToggleButton;\r\nimport android.widget.CompoundButton.OnCheckedChangeListener;\r\n\r\npublic class MainActivity extends Activity implements View.OnClickListener {\r\n\r\n    private final static String LOG_TAG = \"com.example.phdemo.virtualposition\";\r\n\r\n    private IVirtualPositionService virtualpositionService = null;\r\n\tprivate ToggleButton toggleButton = null;\r\n\tprivate EditText altitudeValueText = null;\r\n    private EditText longitudeValueText = null;\r\n    private Button getButton = null;\r\n    private Button setButton = null;\r\n    private Button clearButton = null;\r\n\r\n    /** Called when the activity is first created. */\r\n    @Override\r\n    public void onCreate(Bundle savedInstanceState) {\r\n        super.onCreate(savedInstanceState);\r\n        setContentView(R.layout.activity_main);\r\n\r\n        virtualpositionService = IVirtualPositionService.Stub.asInterface(\r\n                ServiceManager.getService(\"virtualposition\"));\r\n\r\n        toggleButton=(ToggleButton)findViewById(R.id.toggleButton);\r\n\t\taltitudeValueText = (EditText)findViewById(R.id.altitude_value);\r\n\t\tlongitudeValueText = (EditText)findViewById(R.id.longitude_value);\r\n        getButton = (Button)findViewById(R.id.button_get);\r\n        setButton = (Button)findViewById(R.id.button_set);\r\n        clearButton = (Button)findViewById(R.id.button_clear);\r\n        \r\n        getButton.setOnClickListener(this);\r\n        setButton.setOnClickListener(this);\r\n        clearButton.setOnClickListener(this);\r\n\t    \r\n        try{\t\r\n        int val_tog = virtualpositionService.getVirtualToggle();\r\n            if(val_tog == 1){\r\n                toggleButton.setChecked(true);\r\n            }else{\r\n                toggleButton.setChecked(false);\r\n            }\r\n        } catch (Exception e) {}\r\n\r\n        toggleButton.setOnCheckedChangeListener(new OnCheckedChangeListener(){\r\n\t\t\tpublic void onCheckedChanged(CompoundButton buttonView,boolean isChecked) {\r\n\t\t\t\ttoggleButton.setChecked(isChecked);\r\n\t\t\t\ttry{\r\n                    virtualpositionService.setVirtualToggle(isChecked?1:0);\r\n                }catch(Exception e){}\r\n\t\t\t}\r\n\t\t});\r\n        Log.i(LOG_TAG, \"VirtualPosition Activity Created\");\r\n    }\r\n\r\n    @Override\r\n    public void onClick(View v) {\r\n        if(v.equals(getButton)) {\r\n            try {\r\n                double val_altitude = virtualpositionService.getVirtualLatitude();\r\n                String text_altitude = String.valueOf(val_altitude);\r\n                altitudeValueText.setText(text_altitude);\r\n\t\t\t\tdouble val_longitude = virtualpositionService.getVirtualLongitude();\r\n                String text_longitude = String.valueOf(val_longitude);\r\n                longitudeValueText.setText(text_longitude);\r\n\t\t\t\tint val_tog = virtualpositionService.getVirtualToggle();\r\n                if(val_tog == 1){\r\n                    toggleButton.setChecked(true);\r\n                }else{\r\n                    toggleButton.setChecked(false);\r\n                }\r\n            } catch (Exception e) {\r\n                Log.e(LOG_TAG, \"Remote Exception while reading value from GpsLocationProvider.\");\r\n            }\r\n        }\r\n        else if(v.equals(setButton)) {\r\n            try {\r\n                String text_altitude = altitudeValueText.getText().toString();\r\n\t\t\t\tString text_longitude = longitudeValueText.getText().toString();\r\n                double val_altitude = Double.parseDouble(text_altitude);\r\n\t\t\t\tdouble val_longitude = Double.parseDouble(text_longitude);\r\n                virtualpositionService.setVirtualLatitude(val_altitude);\r\n\t\t\t\tvirtualpositionService.setVirtualLongitude(val_longitude);\r\n            } catch (Exception e) {\r\n                Log.e(LOG_TAG, \"Remote Exception while writing value to GpsLocationProvider.\");\r\n            }\r\n        }\r\n        else if(v.equals(clearButton)) {\r\n            String text = \"\";\r\n            altitudeValueText.setText(text);\r\n\t\t\tlongitudeValueText.setText(text);\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "VirtualPosition/vp_APP/VirtualPosition/res/layout/activity_main.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<LinearLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    android:layout_width=\"fill_parent\"\n    android:layout_height=\"fill_parent\"\n    android:orientation=\"vertical\">\n\n    <LinearLayout\n        android:layout_width=\"fill_parent\"\n        android:layout_height=\"wrap_content\"\n        android:gravity=\"center\"\n        android:orientation=\"horizontal\">\n        <TextView\n            android:layout_width=\"wrap_content\"\n            android:layout_height=\"60dp\"\n            android:text=\"@string/toggle\"\n            android:textSize=\"40dp\">\n\n        </TextView>\n        <ToggleButton\n            android:layout_width=\"wrap_content\"\n            android:layout_height=\"wrap_content\"\n            android:text=\"@string/toggle\"\n            android:id=\"@+id/toggleButton\"\n            android:layout_gravity=\"center_horizontal\" />\n    </LinearLayout>\n    <LinearLayout\n        android:layout_width=\"fill_parent\"\n        android:layout_height=\"wrap_content\"\n        android:gravity=\"center\"\n        android:orientation=\"horizontal\">\n\n        <TextView\n            android:layout_width=\"wrap_content\"\n            android:layout_height=\"60dp\"\n            android:text=\"@string/altitude\"\n            android:textSize=\"40dp\">\n\n        </TextView>\n\n        <EditText\n            android:id=\"@+id/altitude_value\"\n            android:layout_width=\"fill_parent\"\n            android:layout_height=\"wrap_content\"\n            android:hint=\"@string/hint_altitude\">\n\n        </EditText>\n    </LinearLayout>\n\n    <LinearLayout\n        android:layout_width=\"fill_parent\"\n        android:layout_height=\"wrap_content\"\n        android:gravity=\"center\"\n        android:orientation=\"horizontal\">\n\n        <TextView\n            android:layout_width=\"wrap_content\"\n            android:layout_height=\"60dp\"\n            android:text=\"@string/longitude\"\n            android:textSize=\"40dp\">\n\n        </TextView>\n\n        <EditText\n            android:id=\"@+id/longitude_value\"\n            android:layout_width=\"fill_parent\"\n            android:layout_height=\"wrap_content\"\n            android:hint=\"@string/hint_longitude\">\n\n        </EditText>\n    </LinearLayout>\n\n    <LinearLayout\n        android:layout_width=\"fill_parent\"\n        android:layout_height=\"wrap_content\"\n        android:gravity=\"center\"\n        android:orientation=\"horizontal\">\n\n        <Button\n            android:id=\"@+id/button_get\"\n            android:layout_width=\"wrap_content\"\n            android:layout_height=\"wrap_content\"\n            android:text=\"@string/get\">\n\n        </Button>\n\n        <Button\n            android:id=\"@+id/button_set\"\n            android:layout_width=\"wrap_content\"\n            android:layout_height=\"wrap_content\"\n            android:text=\"@string/set\">\n\n        </Button>\n\n        <Button\n            android:id=\"@+id/button_clear\"\n            android:layout_width=\"wrap_content\"\n            android:layout_height=\"wrap_content\"\n            android:text=\"@string/clear\">\n\n        </Button>\n    </LinearLayout>\n</LinearLayout>\n"
  },
  {
    "path": "VirtualPosition/vp_APP/VirtualPosition/res/values/colors.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<resources>\n    <color name=\"colorPrimary\">#3F51B5</color>\n    <color name=\"colorPrimaryDark\">#303F9F</color>\n    <color name=\"colorAccent\">#FF4081</color>\n</resources>\n"
  },
  {
    "path": "VirtualPosition/vp_APP/VirtualPosition/res/values/dimens.xml",
    "content": "<resources>\n    <!-- Default screen margins, per the Android Design guidelines. -->\n    <dimen name=\"activity_horizontal_margin\">16dp</dimen>\n    <dimen name=\"activity_vertical_margin\">16dp</dimen>\n</resources>\n"
  },
  {
    "path": "VirtualPosition/vp_APP/VirtualPosition/res/values/strings.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<resources>\n    <string name=\"app_name\">VirtualPosition</string>\n    <string name=\"altitude\">_altitude_</string>\n    <string name=\"longitude\">longitude</string>\n    <string name=\"toggle\">toggle</string>\n    <string name=\"hint_altitude\">Input altitude</string>\n    <string name=\"hint_longitude\">Input longitude</string>\n    <string name=\"get\">GET</string>\n    <string name=\"set\">SET</string>\n    <string name=\"clear\">CLEAR</string>\n</resources>\n"
  },
  {
    "path": "VirtualPosition/vp_APP/VirtualPosition/res/values-w820dp/dimens.xml",
    "content": "<resources>\n    <!-- Example customization of dimensions originally defined in res/values/dimens.xml\n         (such as screen margins) for screens with more than 820dp of available width. This\n         would include 7\" and 10\" devices in landscape (~960dp and ~1280dp respectively). -->\n    <dimen name=\"activity_horizontal_margin\">64dp</dimen>\n</resources>\n"
  },
  {
    "path": "VirtualPosition/vp_Framework/IVirtualPositionService.aidl",
    "content": "package android.os;\n\ninterface IVirtualPositionService {\n    void setVirtualToggle(int tog);\n    int getVirtualToggle();\n    void setVirtualLatitude(double vlat);\n    double getVirtualLatitude();\n    void setVirtualLongitude(double vlon);\n    double getVirtualLongitude();\n}\n"
  },
  {
    "path": "VirtualPosition/vp_Framework/SystemServer.java",
    "content": "/*\n * Copyright (C) 2006 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage com.android.server;\n\nimport android.app.ActivityManagerNative;\nimport android.app.ActivityThread;\nimport android.app.IActivityManager;\nimport android.app.IAlarmManager;\nimport android.app.INotificationManager;\nimport android.app.usage.UsageStatsManagerInternal;\nimport android.content.ComponentName;\nimport android.content.ContentResolver;\nimport android.content.Context;\nimport android.content.Intent;\nimport android.content.pm.IPackageManager;\nimport android.content.pm.PackageManager;\nimport android.content.res.Configuration;\nimport android.content.res.Resources.Theme;\nimport android.database.ContentObserver;\nimport android.os.Build;\nimport android.os.Environment;\nimport android.os.FactoryTest;\nimport android.os.IPowerManager;\nimport android.os.Looper;\nimport android.os.RemoteException;\nimport android.os.ServiceManager;\nimport android.os.StrictMode;\nimport android.os.SystemClock;\nimport android.os.SystemProperties;\nimport android.os.UserHandle;\nimport android.os.storage.IMountService;\nimport android.util.DisplayMetrics;\nimport android.util.EventLog;\nimport android.util.Slog;\nimport android.view.WindowManager;\nimport android.webkit.WebViewFactory;\n\nimport com.android.internal.R;\nimport com.android.internal.os.BinderInternal;\nimport com.android.internal.os.SamplingProfilerIntegration;\nimport com.android.server.accessibility.AccessibilityManagerService;\nimport com.android.server.accounts.AccountManagerService;\nimport com.android.server.am.ActivityManagerService;\nimport com.android.server.audio.AudioService;\nimport com.android.server.camera.CameraService;\nimport com.android.server.clipboard.ClipboardService;\nimport com.android.server.content.ContentService;\nimport com.android.server.devicepolicy.DevicePolicyManagerService;\nimport com.android.server.display.DisplayManagerService;\nimport com.android.server.dreams.DreamManagerService;\nimport com.android.server.fingerprint.FingerprintService;\nimport com.android.server.hdmi.HdmiControlService;\nimport com.android.server.gesture.GestureService;\nimport com.android.server.input.InputManagerService;\nimport com.android.server.job.JobSchedulerService;\nimport com.android.server.lights.LightsService;\nimport com.android.server.media.MediaRouterService;\nimport com.android.server.media.MediaSessionService;\nimport com.android.server.media.projection.MediaProjectionManagerService;\nimport com.android.server.net.NetworkPolicyManagerService;\nimport com.android.server.net.NetworkStatsService;\nimport com.android.server.notification.NotificationManagerService;\nimport com.android.server.os.SchedulingPolicyService;\nimport com.android.server.pm.BackgroundDexOptService;\nimport com.android.server.pm.Installer;\nimport com.android.server.pm.LauncherAppsService;\nimport com.android.server.pm.PackageManagerService;\nimport com.android.server.pm.UserManagerService;\nimport com.android.server.power.PowerManagerService;\nimport com.android.server.power.ShutdownThread;\nimport com.android.server.restrictions.RestrictionsManagerService;\nimport com.android.server.search.SearchManagerService;\nimport com.android.server.statusbar.StatusBarManagerService;\nimport com.android.server.storage.DeviceStorageMonitorService;\nimport com.android.server.telecom.TelecomLoaderService;\nimport com.android.server.trust.TrustManagerService;\nimport com.android.server.tv.TvInputManagerService;\nimport com.android.server.twilight.TwilightService;\nimport com.android.server.usage.UsageStatsService;\nimport com.android.server.usb.UsbService;\nimport com.android.server.wallpaper.WallpaperManagerService;\nimport com.android.server.webkit.WebViewUpdateService;\nimport com.android.server.wm.WindowManagerService;\n\nimport cyanogenmod.providers.CMSettings;\nimport dalvik.system.VMRuntime;\n\nimport java.io.File;\nimport java.lang.reflect.Constructor;\nimport java.lang.reflect.InvocationTargetException;\nimport java.lang.reflect.Method;\nimport java.util.Locale;\nimport java.util.Timer;\nimport java.util.TimerTask;\n\npublic final class SystemServer {\n    private static final String TAG = \"SystemServer\";\n\n    private static final String ENCRYPTING_STATE = \"trigger_restart_min_framework\";\n    private static final String ENCRYPTED_STATE = \"1\";\n\n    private static final long SNAPSHOT_INTERVAL = 60 * 60 * 1000; // 1hr\n\n    // The earliest supported time.  We pick one day into 1970, to\n    // give any timezone code room without going into negative time.\n    private static final long EARLIEST_SUPPORTED_TIME = 86400 * 1000;\n\n    /*\n     * Implementation class names. TODO: Move them to a codegen class or load\n     * them from the build system somehow.\n     */\n    private static final String BACKUP_MANAGER_SERVICE_CLASS =\n            \"com.android.server.backup.BackupManagerService$Lifecycle\";\n    private static final String APPWIDGET_SERVICE_CLASS =\n            \"com.android.server.appwidget.AppWidgetService\";\n    private static final String VOICE_RECOGNITION_MANAGER_SERVICE_CLASS =\n            \"com.android.server.voiceinteraction.VoiceInteractionManagerService\";\n    private static final String PRINT_MANAGER_SERVICE_CLASS =\n            \"com.android.server.print.PrintManagerService\";\n    private static final String USB_SERVICE_CLASS =\n            \"com.android.server.usb.UsbService$Lifecycle\";\n    private static final String MIDI_SERVICE_CLASS =\n            \"com.android.server.midi.MidiService$Lifecycle\";\n    private static final String WIFI_SERVICE_CLASS =\n            \"com.android.server.wifi.WifiService\";\n    private static final String WIFI_P2P_SERVICE_CLASS =\n            \"com.android.server.wifi.p2p.WifiP2pService\";\n    private static final String ETHERNET_SERVICE_CLASS =\n            \"com.android.server.ethernet.EthernetService\";\n    private static final String JOB_SCHEDULER_SERVICE_CLASS =\n            \"com.android.server.job.JobSchedulerService\";\n    private static final String MOUNT_SERVICE_CLASS =\n            \"com.android.server.MountService$Lifecycle\";\n    private static final String PERSISTENT_DATA_BLOCK_PROP = \"ro.frp.pst\";\n\n    private final int mFactoryTestMode;\n    private Timer mProfilerSnapshotTimer;\n\n    private Context mSystemContext;\n    private SystemServiceManager mSystemServiceManager;\n\n    // TODO: remove all of these references by improving dependency resolution and boot phases\n    private PowerManagerService mPowerManagerService;\n    private ActivityManagerService mActivityManagerService;\n    private DisplayManagerService mDisplayManagerService;\n    private PackageManagerService mPackageManagerService;\n    private PackageManager mPackageManager;\n    private ContentResolver mContentResolver;\n\n    private boolean mOnlyCore;\n    private boolean mFirstBoot;\n\n    /**\n     * Start the sensor service.\n     */\n    private static native void startSensorService();\n\n    /**\n     * The main entry point from zygote.\n     */\n    public static void main(String[] args) {\n        new SystemServer().run();\n    }\n\n    public SystemServer() {\n        // Check for factory test mode.\n        mFactoryTestMode = FactoryTest.getMode();\n    }\n\n    private class AdbPortObserver extends ContentObserver {\n        public AdbPortObserver() {\n            super(null);\n        }\n        @Override\n        public void onChange(boolean selfChange) {\n            int adbPort = CMSettings.Secure.getInt(mContentResolver,\n                CMSettings.Secure.ADB_PORT, 0);\n            // setting this will control whether ADB runs on TCP/IP or USB\n            SystemProperties.set(\"adb.network.port\", Integer.toString(adbPort));\n        }\n    }\n\n    private void run() {\n        // If a device's clock is before 1970 (before 0), a lot of\n        // APIs crash dealing with negative numbers, notably\n        // java.io.File#setLastModified, so instead we fake it and\n        // hope that time from cell towers or NTP fixes it shortly.\n        if (System.currentTimeMillis() < EARLIEST_SUPPORTED_TIME) {\n            Slog.w(TAG, \"System clock is before 1970; setting to 1970.\");\n            SystemClock.setCurrentTimeMillis(EARLIEST_SUPPORTED_TIME);\n        }\n\n        // If the system has \"persist.sys.language\" and friends set, replace them with\n        // \"persist.sys.locale\". Note that the default locale at this point is calculated\n        // using the \"-Duser.locale\" command line flag. That flag is usually populated by\n        // AndroidRuntime using the same set of system properties, but only the system_server\n        // and system apps are allowed to set them.\n        //\n        // NOTE: Most changes made here will need an equivalent change to\n        // core/jni/AndroidRuntime.cpp\n        if (!SystemProperties.get(\"persist.sys.language\").isEmpty()) {\n            final String languageTag = Locale.getDefault().toLanguageTag();\n\n            SystemProperties.set(\"persist.sys.locale\", languageTag);\n            SystemProperties.set(\"persist.sys.language\", \"\");\n            SystemProperties.set(\"persist.sys.country\", \"\");\n            SystemProperties.set(\"persist.sys.localevar\", \"\");\n        }\n\n        // Here we go!\n        Slog.i(TAG, \"Entered the Android system server!\");\n        EventLog.writeEvent(EventLogTags.BOOT_PROGRESS_SYSTEM_RUN, SystemClock.uptimeMillis());\n\n        // In case the runtime switched since last boot (such as when\n        // the old runtime was removed in an OTA), set the system\n        // property so that it is in sync. We can't do this in\n        // libnativehelper's JniInvocation::Init code where we already\n        // had to fallback to a different runtime because it is\n        // running as root and we need to be the system user to set\n        // the property. http://b/11463182\n        SystemProperties.set(\"persist.sys.dalvik.vm.lib.2\", VMRuntime.getRuntime().vmLibrary());\n\n        // Enable the sampling profiler.\n        if (SamplingProfilerIntegration.isEnabled()) {\n            SamplingProfilerIntegration.start();\n            mProfilerSnapshotTimer = new Timer();\n            mProfilerSnapshotTimer.schedule(new TimerTask() {\n                @Override\n                public void run() {\n                    SamplingProfilerIntegration.writeSnapshot(\"system_server\", null);\n                }\n            }, SNAPSHOT_INTERVAL, SNAPSHOT_INTERVAL);\n        }\n\n        // Mmmmmm... more memory!\n        VMRuntime.getRuntime().clearGrowthLimit();\n\n        // The system server has to run all of the time, so it needs to be\n        // as efficient as possible with its memory usage.\n        VMRuntime.getRuntime().setTargetHeapUtilization(0.8f);\n\n        // Some devices rely on runtime fingerprint generation, so make sure\n        // we've defined it before booting further.\n        Build.ensureFingerprintProperty();\n\n        // Within the system server, it is an error to access Environment paths without\n        // explicitly specifying a user.\n        Environment.setUserRequired(true);\n\n        // Ensure binder calls into the system always run at foreground priority.\n        BinderInternal.disableBackgroundScheduling(true);\n\n        // Prepare the main looper thread (this thread).\n        android.os.Process.setThreadPriority(\n                android.os.Process.THREAD_PRIORITY_FOREGROUND);\n        android.os.Process.setCanSelfBackground(false);\n        Looper.prepareMainLooper();\n\n        // Initialize native services.\n        System.loadLibrary(\"android_servers\");\n\n        // Check whether we failed to shut down last time we tried.\n        // This call may not return.\n        performPendingShutdown();\n\n        // Initialize the system context.\n        createSystemContext();\n\n        // Create the system service manager.\n        mSystemServiceManager = new SystemServiceManager(mSystemContext);\n        LocalServices.addService(SystemServiceManager.class, mSystemServiceManager);\n\n        // Start services.\n        try {\n            startBootstrapServices();\n            startCoreServices();\n            startOtherServices();\n        } catch (Throwable ex) {\n            Slog.e(\"System\", \"******************************************\");\n            Slog.e(\"System\", \"************ Failure starting system services\", ex);\n            throw ex;\n        }\n\n        // For debug builds, log event loop stalls to dropbox for analysis.\n        if (StrictMode.conditionallyEnableDebugLogging()) {\n            Slog.i(TAG, \"Enabled StrictMode for system server main thread.\");\n        }\n\n        // Loop forever.\n        Looper.loop();\n        throw new RuntimeException(\"Main thread loop unexpectedly exited\");\n    }\n\n    private void reportWtf(String msg, Throwable e) {\n        Slog.w(TAG, \"***********************************************\");\n        Slog.wtf(TAG, \"BOOT FAILURE \" + msg, e);\n    }\n\n    private void performPendingShutdown() {\n        final String shutdownAction = SystemProperties.get(\n                ShutdownThread.SHUTDOWN_ACTION_PROPERTY, \"\");\n        if (shutdownAction != null && shutdownAction.length() > 0) {\n            boolean reboot = (shutdownAction.charAt(0) == '1');\n\n            final String reason;\n            if (shutdownAction.length() > 1) {\n                reason = shutdownAction.substring(1, shutdownAction.length());\n            } else {\n                reason = null;\n            }\n\n            ShutdownThread.rebootOrShutdown(null, reboot, reason);\n        }\n    }\n\n    private void createSystemContext() {\n        ActivityThread activityThread = ActivityThread.systemMain();\n        mSystemContext = activityThread.getSystemContext();\n        mSystemContext.setTheme(com.android.internal.R.style.Theme_Power_Dialog);\n    }\n\n    /**\n     * Starts the small tangle of critical services that are needed to get\n     * the system off the ground.  These services have complex mutual dependencies\n     * which is why we initialize them all in one place here.  Unless your service\n     * is also entwined in these dependencies, it should be initialized in one of\n     * the other functions.\n     */\n    private void startBootstrapServices() {\n        // Wait for installd to finish starting up so that it has a chance to\n        // create critical directories such as /data/user with the appropriate\n        // permissions.  We need this to complete before we initialize other services.\n        Installer installer = mSystemServiceManager.startService(Installer.class);\n\n        // Activity manager runs the show.\n        mActivityManagerService = mSystemServiceManager.startService(\n                ActivityManagerService.Lifecycle.class).getService();\n        mActivityManagerService.setSystemServiceManager(mSystemServiceManager);\n        mActivityManagerService.setInstaller(installer);\n\n        // Power manager needs to be started early because other services need it.\n        // Native daemons may be watching for it to be registered so it must be ready\n        // to handle incoming binder calls immediately (including being able to verify\n        // the permissions for those calls).\n        mPowerManagerService = mSystemServiceManager.startService(PowerManagerService.class);\n\n        // Now that the power manager has been started, let the activity manager\n        // initialize power management features.\n        mActivityManagerService.initPowerManagement();\n\n        // Manages LEDs and display backlight so we need it to bring up the display.\n        mSystemServiceManager.startService(LightsService.class);\n\n        // Display manager is needed to provide display metrics before package manager\n        // starts up.\n        mDisplayManagerService = mSystemServiceManager.startService(DisplayManagerService.class);\n\n        // We need the default display before we can initialize the package manager.\n        mSystemServiceManager.startBootPhase(SystemService.PHASE_WAIT_FOR_DEFAULT_DISPLAY);\n\n        // Only run \"core\" apps if we're encrypting the device.\n        String cryptState = SystemProperties.get(\"vold.decrypt\");\n        if (ENCRYPTING_STATE.equals(cryptState)) {\n            Slog.w(TAG, \"Detected encryption in progress - only parsing core apps\");\n            mOnlyCore = true;\n        } else if (ENCRYPTED_STATE.equals(cryptState)) {\n            Slog.w(TAG, \"Device encrypted - only parsing core apps\");\n            mOnlyCore = true;\n        }\n\n        // Start the package manager.\n        Slog.i(TAG, \"Package Manager\");\n        mPackageManagerService = PackageManagerService.main(mSystemContext, installer,\n                mFactoryTestMode != FactoryTest.FACTORY_TEST_OFF, mOnlyCore);\n        mFirstBoot = mPackageManagerService.isFirstBoot();\n        mPackageManager = mSystemContext.getPackageManager();\n\n        Slog.i(TAG, \"User Service\");\n        ServiceManager.addService(Context.USER_SERVICE, UserManagerService.getInstance());\n\n        // Initialize attribute cache used to cache resources from packages.\n        AttributeCache.init(mSystemContext);\n\n        // Set up the Application instance for the system process and get started.\n        mActivityManagerService.setSystemProcess();\n\n        // The sensor service needs access to package manager service, app ops\n        // service, and permissions service, therefore we start it after them.\n        startSensorService();\n    }\n\n    /**\n     * Starts some essential services that are not tangled up in the bootstrap process.\n     */\n    private void startCoreServices() {\n        // Tracks the battery level.  Requires LightService.\n        mSystemServiceManager.startService(BatteryService.class);\n\n        // Tracks application usage stats.\n        mSystemServiceManager.startService(UsageStatsService.class);\n        mActivityManagerService.setUsageStatsManager(\n                LocalServices.getService(UsageStatsManagerInternal.class));\n        // Update after UsageStatsService is available, needed before performBootDexOpt.\n        mPackageManagerService.getUsageStatsIfNoPackageUsageInfo();\n\n        // Tracks whether the updatable WebView is in a ready state and watches for update installs.\n        mSystemServiceManager.startService(WebViewUpdateService.class);\n    }\n\n    /**\n     * Starts a miscellaneous grab bag of stuff that has yet to be refactored\n     * and organized.\n     */\n    private void startOtherServices() {\n        final Context context = mSystemContext;\n        AccountManagerService accountManager = null;\n        ContentService contentService = null;\n        VibratorService vibrator = null;\n        IAlarmManager alarm = null;\n        IMountService mountService = null;\n        NetworkManagementService networkManagement = null;\n        NetworkStatsService networkStats = null;\n        NetworkPolicyManagerService networkPolicy = null;\n        ConnectivityService connectivity = null;\n        NetworkScoreService networkScore = null;\n        NsdService serviceDiscovery= null;\n        WindowManagerService wm = null;\n        UsbService usb = null;\n        SerialService serial = null;\n        NetworkTimeUpdateService networkTimeUpdater = null;\n        CommonTimeManagementService commonTimeMgmtService = null;\n        InputManagerService inputManager = null;\n        TelephonyRegistry telephonyRegistry = null;\n        ConsumerIrService consumerIr = null;\n        AudioService audioService = null;\n        MmsServiceBroker mmsService = null;\n        EntropyMixer entropyMixer = null;\n        CameraService cameraService = null;\n\n        boolean disableStorage = SystemProperties.getBoolean(\"config.disable_storage\", false);\n        boolean disableBluetooth = SystemProperties.getBoolean(\"config.disable_bluetooth\", false);\n        boolean disableLocation = SystemProperties.getBoolean(\"config.disable_location\", false);\n        boolean disableSystemUI = SystemProperties.getBoolean(\"config.disable_systemui\", false);\n        boolean disableNonCoreServices = SystemProperties.getBoolean(\"config.disable_noncore\", false);\n        boolean disableNetwork = SystemProperties.getBoolean(\"config.disable_network\", false);\n        boolean disableNetworkTime = SystemProperties.getBoolean(\"config.disable_networktime\", false);\n        boolean isEmulator = SystemProperties.get(\"ro.kernel.qemu\").equals(\"1\");\n        String externalServer = context.getResources().getString(\n                org.cyanogenmod.platform.internal.R.string.config_externalSystemServer);\n        boolean disableAtlas = SystemProperties.getBoolean(\"config.disable_atlas\", false);\n\n        try {\n            Slog.i(TAG, \"Reading configuration...\");\n            SystemConfig.getInstance();\n\n            Slog.i(TAG, \"Scheduling Policy\");\n            ServiceManager.addService(\"scheduling_policy\", new SchedulingPolicyService());\n\n            mSystemServiceManager.startService(TelecomLoaderService.class);\n\n            Slog.i(TAG, \"Telephony Registry\");\n            telephonyRegistry = new TelephonyRegistry(context);\n            ServiceManager.addService(\"telephony.registry\", telephonyRegistry);\n\n            Slog.i(TAG, \"Entropy Mixer\");\n            entropyMixer = new EntropyMixer(context);\n\n            mContentResolver = context.getContentResolver();\n\n            Slog.i(TAG, \"Camera Service\");\n            mSystemServiceManager.startService(CameraService.class);\n\n            // The AccountManager must come before the ContentService\n            try {\n                // TODO: seems like this should be disable-able, but req'd by ContentService\n                Slog.i(TAG, \"Account Manager\");\n                accountManager = new AccountManagerService(context);\n                ServiceManager.addService(Context.ACCOUNT_SERVICE, accountManager);\n            } catch (Throwable e) {\n                Slog.e(TAG, \"Failure starting Account Manager\", e);\n            }\n\n            Slog.i(TAG, \"Content Manager\");\n            contentService = ContentService.main(context,\n                    mFactoryTestMode == FactoryTest.FACTORY_TEST_LOW_LEVEL);\n\n            Slog.i(TAG, \"System Content Providers\");\n            mActivityManagerService.installSystemProviders();\n\n            Slog.i(TAG, \"Vibrator Service\");\n            vibrator = new VibratorService(context);\n            ServiceManager.addService(\"vibrator\", vibrator);\n\n            Slog.i(TAG, \"Consumer IR Service\");\n            consumerIr = new ConsumerIrService(context);\n            ServiceManager.addService(Context.CONSUMER_IR_SERVICE, consumerIr);\n\n            mSystemServiceManager.startService(AlarmManagerService.class);\n            alarm = IAlarmManager.Stub.asInterface(\n                    ServiceManager.getService(Context.ALARM_SERVICE));\n\n            Slog.i(TAG, \"Init Watchdog\");\n            final Watchdog watchdog = Watchdog.getInstance();\n            watchdog.init(context, mActivityManagerService);\n\n            Slog.i(TAG, \"Input Manager\");\n            inputManager = new InputManagerService(context);\n\n            Slog.i(TAG, \"Window Manager\");\n            wm = WindowManagerService.main(context, inputManager,\n                    mFactoryTestMode != FactoryTest.FACTORY_TEST_LOW_LEVEL,\n                    true, mOnlyCore);\n            ServiceManager.addService(Context.WINDOW_SERVICE, wm);\n            ServiceManager.addService(Context.INPUT_SERVICE, inputManager);\n\n            mActivityManagerService.setWindowManager(wm);\n\n            inputManager.setWindowManagerCallbacks(wm.getInputMonitor());\n            inputManager.start();\n\n            // TODO: Use service dependencies instead.\n            mDisplayManagerService.windowManagerAndInputReady();\n\n            // Skip Bluetooth if we have an emulator kernel\n            // TODO: Use a more reliable check to see if this product should\n            // support Bluetooth - see bug 988521\n            if (isEmulator) {\n                Slog.i(TAG, \"No Bluetooh Service (emulator)\");\n            } else if (mFactoryTestMode == FactoryTest.FACTORY_TEST_LOW_LEVEL) {\n                Slog.i(TAG, \"No Bluetooth Service (factory test)\");\n            } else if (!context.getPackageManager().hasSystemFeature\n                       (PackageManager.FEATURE_BLUETOOTH)) {\n                Slog.i(TAG, \"No Bluetooth Service (Bluetooth Hardware Not Present)\");\n            } else if (disableBluetooth) {\n                Slog.i(TAG, \"Bluetooth Service disabled by config\");\n            } else {\n                Slog.i(TAG, \"Bluetooth Service\");\n                mSystemServiceManager.startService(BluetoothService.class);\n            }\n        } catch (RuntimeException e) {\n            Slog.e(\"System\", \"******************************************\");\n            Slog.e(\"System\", \"************ Failure starting core service\", e);\n        }\n\n        StatusBarManagerService statusBar = null;\n        INotificationManager notification = null;\n        InputMethodManagerService imm = null;\n        WallpaperManagerService wallpaper = null;\n        LocationManagerService location = null;\n        CountryDetectorService countryDetector = null;\n        TextServicesManagerService tsms = null;\n        LockSettingsService lockSettings = null;\n        AssetAtlasService atlas = null;\n        MediaRouterService mediaRouter = null;\n        GestureService gestureService = null;\n\n        // Bring up services needed for UI.\n        if (mFactoryTestMode != FactoryTest.FACTORY_TEST_LOW_LEVEL) {\n            try {\n                Slog.i(TAG, \"Input Method Service\");\n                imm = new InputMethodManagerService(context, wm);\n                ServiceManager.addService(Context.INPUT_METHOD_SERVICE, imm);\n            } catch (Throwable e) {\n                reportWtf(\"starting Input Manager Service\", e);\n            }\n\n            try {\n                Slog.i(TAG, \"Accessibility Manager\");\n                ServiceManager.addService(Context.ACCESSIBILITY_SERVICE,\n                        new AccessibilityManagerService(context));\n            } catch (Throwable e) {\n                reportWtf(\"starting Accessibility Manager\", e);\n            }\n        }\n\n        try {\n            wm.displayReady();\n        } catch (Throwable e) {\n            reportWtf(\"making display ready\", e);\n        }\n\n        if (mFactoryTestMode != FactoryTest.FACTORY_TEST_LOW_LEVEL) {\n            if (!disableStorage &&\n                !\"0\".equals(SystemProperties.get(\"system_init.startmountservice\"))) {\n                try {\n                    /*\n                     * NotificationManagerService is dependant on MountService,\n                     * (for media / usb notifications) so we must start MountService first.\n                     */\n                    mSystemServiceManager.startService(MOUNT_SERVICE_CLASS);\n                    mountService = IMountService.Stub.asInterface(\n                            ServiceManager.getService(\"mount\"));\n                } catch (Throwable e) {\n                    reportWtf(\"starting Mount Service\", e);\n                }\n            }\n        }\n\n        // We start this here so that we update our configuration to set watch or television\n        // as appropriate.\n        mSystemServiceManager.startService(UiModeManagerService.class);\n\n        try {\n            mPackageManagerService.performBootDexOpt();\n        } catch (Throwable e) {\n            reportWtf(\"performing boot dexopt\", e);\n        }\n\n        try {\n            ActivityManagerNative.getDefault().updateBootProgress(\n                    IActivityManager.BOOT_STAGE_STARTING_APPS, null, 0, 0, false);\n        } catch (RemoteException e) {\n        }\n\n        if (mFactoryTestMode != FactoryTest.FACTORY_TEST_LOW_LEVEL) {\n            if (!disableNonCoreServices) {\n                try {\n                    Slog.i(TAG,  \"LockSettingsService\");\n                    lockSettings = new LockSettingsService(context);\n                    ServiceManager.addService(\"lock_settings\", lockSettings);\n                } catch (Throwable e) {\n                    reportWtf(\"starting LockSettingsService service\", e);\n                }\n\n                if (!SystemProperties.get(PERSISTENT_DATA_BLOCK_PROP).equals(\"\")) {\n                    mSystemServiceManager.startService(PersistentDataBlockService.class);\n                }\n\n                mSystemServiceManager.startService(DeviceIdleController.class);\n\n                // Always start the Device Policy Manager, so that the API is compatible with\n                // API8.\n                mSystemServiceManager.startService(DevicePolicyManagerService.Lifecycle.class);\n            }\n\n            if (!disableSystemUI) {\n                try {\n                    Slog.i(TAG, \"Status Bar\");\n                    statusBar = new StatusBarManagerService(context, wm);\n                    ServiceManager.addService(Context.STATUS_BAR_SERVICE, statusBar);\n                } catch (Throwable e) {\n                    reportWtf(\"starting StatusBarManagerService\", e);\n                }\n            }\n\n            if (!disableNonCoreServices) {\n                try {\n                    Slog.i(TAG, \"Clipboard Service\");\n                    ServiceManager.addService(Context.CLIPBOARD_SERVICE,\n                            new ClipboardService(context));\n                } catch (Throwable e) {\n                    reportWtf(\"starting Clipboard Service\", e);\n                }\n            }\n\n            if (!disableNetwork) {\n                try {\n                    Slog.i(TAG, \"NetworkManagement Service\");\n                    networkManagement = NetworkManagementService.create(context);\n                    ServiceManager.addService(Context.NETWORKMANAGEMENT_SERVICE, networkManagement);\n                } catch (Throwable e) {\n                    reportWtf(\"starting NetworkManagement Service\", e);\n                }\n            }\n\n            if (!disableNonCoreServices) {\n                try {\n                    Slog.i(TAG, \"Text Service Manager Service\");\n                    tsms = new TextServicesManagerService(context);\n                    ServiceManager.addService(Context.TEXT_SERVICES_MANAGER_SERVICE, tsms);\n                } catch (Throwable e) {\n                    reportWtf(\"starting Text Service Manager Service\", e);\n                }\n            }\n\n            if (!disableNetwork) {\n                try {\n                    Slog.i(TAG, \"Network Score Service\");\n                    networkScore = new NetworkScoreService(context);\n                    ServiceManager.addService(Context.NETWORK_SCORE_SERVICE, networkScore);\n                } catch (Throwable e) {\n                    reportWtf(\"starting Network Score Service\", e);\n                }\n\n                try {\n                    Slog.i(TAG, \"NetworkStats Service\");\n                    networkStats = new NetworkStatsService(context, networkManagement, alarm);\n                    ServiceManager.addService(Context.NETWORK_STATS_SERVICE, networkStats);\n                } catch (Throwable e) {\n                    reportWtf(\"starting NetworkStats Service\", e);\n                }\n\n                try {\n                    Slog.i(TAG, \"NetworkPolicy Service\");\n                    networkPolicy = new NetworkPolicyManagerService(\n                            context, mActivityManagerService,\n                            (IPowerManager)ServiceManager.getService(Context.POWER_SERVICE),\n                            networkStats, networkManagement);\n                    ServiceManager.addService(Context.NETWORK_POLICY_SERVICE, networkPolicy);\n                } catch (Throwable e) {\n                    reportWtf(\"starting NetworkPolicy Service\", e);\n                }\n\n                mSystemServiceManager.startService(WIFI_P2P_SERVICE_CLASS);\n                mSystemServiceManager.startService(WIFI_SERVICE_CLASS);\n                mSystemServiceManager.startService(\n                            \"com.android.server.wifi.WifiScanningService\");\n\n                mSystemServiceManager.startService(\"com.android.server.wifi.RttService\");\n\n                if (mPackageManager.hasSystemFeature(PackageManager.FEATURE_ETHERNET) ||\n                    mPackageManager.hasSystemFeature(PackageManager.FEATURE_USB_HOST)) {\n                    mSystemServiceManager.startService(ETHERNET_SERVICE_CLASS);\n                }\n\n                try {\n                    Slog.i(TAG, \"Connectivity Service\");\n                    connectivity = new ConnectivityService(\n                            context, networkManagement, networkStats, networkPolicy);\n                    ServiceManager.addService(Context.CONNECTIVITY_SERVICE, connectivity);\n                    networkStats.bindConnectivityManager(connectivity);\n                    networkPolicy.bindConnectivityManager(connectivity);\n                } catch (Throwable e) {\n                    reportWtf(\"starting Connectivity Service\", e);\n                }\n\n                try {\n                    Slog.i(TAG, \"Network Service Discovery Service\");\n                    serviceDiscovery = NsdService.create(context);\n                    ServiceManager.addService(\n                            Context.NSD_SERVICE, serviceDiscovery);\n                } catch (Throwable e) {\n                    reportWtf(\"starting Service Discovery Service\", e);\n                }\n            }\n\n            if (!disableNonCoreServices) {\n                try {\n                    Slog.i(TAG, \"UpdateLock Service\");\n                    ServiceManager.addService(Context.UPDATE_LOCK_SERVICE,\n                            new UpdateLockService(context));\n                } catch (Throwable e) {\n                    reportWtf(\"starting UpdateLockService\", e);\n                }\n            }\n\n            /*\n             * MountService has a few dependencies: Notification Manager and\n             * AppWidget Provider. Make sure MountService is completely started\n             * first before continuing.\n             */\n            if (mountService != null && !mOnlyCore) {\n                try {\n                    mountService.waitForAsecScan();\n                } catch (RemoteException ignored) {\n                }\n            }\n\n            try {\n                if (accountManager != null)\n                    accountManager.systemReady();\n            } catch (Throwable e) {\n                reportWtf(\"making Account Manager Service ready\", e);\n            }\n\n            try {\n                if (contentService != null)\n                    contentService.systemReady();\n            } catch (Throwable e) {\n                reportWtf(\"making Content Service ready\", e);\n            }\n\n            mSystemServiceManager.startService(NotificationManagerService.class);\n            notification = INotificationManager.Stub.asInterface(\n                    ServiceManager.getService(Context.NOTIFICATION_SERVICE));\n            networkPolicy.bindNotificationManager(notification);\n\n            mSystemServiceManager.startService(DeviceStorageMonitorService.class);\n\n            if (!disableLocation) {\n                try {\n                    Slog.i(TAG, \"Location Manager\");\n                    location = new LocationManagerService(context);\n                    ServiceManager.addService(Context.LOCATION_SERVICE, location);\n                } catch (Throwable e) {\n                    reportWtf(\"starting Location Manager\", e);\n                }\n\n                try {\n                    Slog.i(TAG, \"Country Detector\");\n                    countryDetector = new CountryDetectorService(context);\n                    ServiceManager.addService(Context.COUNTRY_DETECTOR, countryDetector);\n                } catch (Throwable e) {\n                    reportWtf(\"starting Country Detector\", e);\n                }\n            }\n\n            if (!disableNonCoreServices) {\n                try {\n                    Slog.i(TAG, \"Search Service\");\n                    ServiceManager.addService(Context.SEARCH_SERVICE,\n                            new SearchManagerService(context));\n                } catch (Throwable e) {\n                    reportWtf(\"starting Search Service\", e);\n                }\n            }\n\n            try {\n                Slog.i(TAG, \"DropBox Service\");\n                ServiceManager.addService(Context.DROPBOX_SERVICE,\n                        new DropBoxManagerService(context, new File(\"/data/system/dropbox\")));\n            } catch (Throwable e) {\n                reportWtf(\"starting DropBoxManagerService\", e);\n            }\n\n            if (!disableNonCoreServices && context.getResources().getBoolean(\n                        R.bool.config_enableWallpaperService)) {\n                try {\n                    Slog.i(TAG, \"Wallpaper Service\");\n                    wallpaper = new WallpaperManagerService(context);\n                    ServiceManager.addService(Context.WALLPAPER_SERVICE, wallpaper);\n                } catch (Throwable e) {\n                    reportWtf(\"starting Wallpaper Service\", e);\n                }\n            }\n\n            try {\n                Slog.i(TAG, \"Audio Service\");\n                audioService = new AudioService(context);\n                ServiceManager.addService(Context.AUDIO_SERVICE, audioService);\n            } catch (Throwable e) {\n                reportWtf(\"starting Audio Service\", e);\n            }\n\n            if (!disableNonCoreServices) {\n                mSystemServiceManager.startService(DockObserver.class);\n\n                if (context.getPackageManager().hasSystemFeature\n                        (PackageManager.FEATURE_WATCH)) {\n                    mSystemServiceManager.startService(ThermalObserver.class);\n                }\n            }\n\n            try {\n                Slog.i(TAG, \"Wired Accessory Manager\");\n                // Listen for wired headset changes\n                inputManager.setWiredAccessoryCallbacks(\n                        new WiredAccessoryManager(context, inputManager));\n            } catch (Throwable e) {\n                reportWtf(\"starting WiredAccessoryManager\", e);\n            }\n\n            if (!disableNonCoreServices) {\n                if (mPackageManager.hasSystemFeature(PackageManager.FEATURE_MIDI)) {\n                    // Start MIDI Manager service\n                    mSystemServiceManager.startService(MIDI_SERVICE_CLASS);\n                }\n\n                if (mPackageManager.hasSystemFeature(PackageManager.FEATURE_USB_HOST)\n                        || mPackageManager.hasSystemFeature(\n                                PackageManager.FEATURE_USB_ACCESSORY)) {\n                    // Manage USB host and device support\n                    mSystemServiceManager.startService(USB_SERVICE_CLASS);\n                }\n\n                try {\n                    Slog.i(TAG, \"Serial Service\");\n                    // Serial port support\n                    serial = new SerialService(context);\n                    ServiceManager.addService(Context.SERIAL_SERVICE, serial);\n                } catch (Throwable e) {\n                    Slog.e(TAG, \"Failure starting SerialService\", e);\n                }\n            }\n\n            mSystemServiceManager.startService(TwilightService.class);\n\n            mSystemServiceManager.startService(JobSchedulerService.class);\n\n            if (!disableNonCoreServices) {\n                if (mPackageManager.hasSystemFeature(PackageManager.FEATURE_BACKUP)) {\n                    mSystemServiceManager.startService(BACKUP_MANAGER_SERVICE_CLASS);\n                }\n\n                if (mPackageManager.hasSystemFeature(PackageManager.FEATURE_APP_WIDGETS)) {\n                    mSystemServiceManager.startService(APPWIDGET_SERVICE_CLASS);\n                }\n\n                if (mPackageManager.hasSystemFeature(PackageManager.FEATURE_VOICE_RECOGNIZERS)) {\n                    mSystemServiceManager.startService(VOICE_RECOGNITION_MANAGER_SERVICE_CLASS);\n                }\n\n                if (GestureLauncherService.isGestureLauncherEnabled(context.getResources())) {\n                    Slog.i(TAG, \"Gesture Launcher Service\");\n                    mSystemServiceManager.startService(GestureLauncherService.class);\n                }\n            }\n\n            try {\n                Slog.i(TAG, \"DiskStats Service\");\n                ServiceManager.addService(\"diskstats\", new DiskStatsService(context));\n            } catch (Throwable e) {\n                reportWtf(\"starting DiskStats Service\", e);\n            }\n            \n            try {\n                Slog.i(TAG, \"VirtualPosition Service\");\n                ServiceManager.addService(\"virtualposition\", new VirtualPositionService());\n            } catch (Throwable e) {\n                reportWtf(\"starting VirtualPosition Service\", e);\n            }\n\n\n            try {\n                // need to add this service even if SamplingProfilerIntegration.isEnabled()\n                // is false, because it is this service that detects system property change and\n                // turns on SamplingProfilerIntegration. Plus, when sampling profiler doesn't work,\n                // there is little overhead for running this service.\n                Slog.i(TAG, \"SamplingProfiler Service\");\n                ServiceManager.addService(\"samplingprofiler\",\n                            new SamplingProfilerService(context));\n            } catch (Throwable e) {\n                reportWtf(\"starting SamplingProfiler Service\", e);\n            }\n\n            if (!disableNetwork && !disableNetworkTime) {\n                try {\n                    Slog.i(TAG, \"NetworkTimeUpdateService\");\n                    networkTimeUpdater = new NetworkTimeUpdateService(context);\n                } catch (Throwable e) {\n                    reportWtf(\"starting NetworkTimeUpdate service\", e);\n                }\n            }\n\n            try {\n                Slog.i(TAG, \"CommonTimeManagementService\");\n                commonTimeMgmtService = new CommonTimeManagementService(context);\n                ServiceManager.addService(\"commontime_management\", commonTimeMgmtService);\n            } catch (Throwable e) {\n                reportWtf(\"starting CommonTimeManagementService service\", e);\n            }\n\n            if (!disableNetwork) {\n                try {\n                    Slog.i(TAG, \"CertBlacklister\");\n                    CertBlacklister blacklister = new CertBlacklister(context);\n                } catch (Throwable e) {\n                    reportWtf(\"starting CertBlacklister\", e);\n                }\n            }\n\n            if (!disableNonCoreServices) {\n                // Dreams (interactive idle-time views, a/k/a screen savers, and doze mode)\n                mSystemServiceManager.startService(DreamManagerService.class);\n            }\n\n            if (!disableNonCoreServices && !disableAtlas) {\n                try {\n                    Slog.i(TAG, \"Assets Atlas Service\");\n                    atlas = new AssetAtlasService(context);\n                    ServiceManager.addService(AssetAtlasService.ASSET_ATLAS_SERVICE, atlas);\n                } catch (Throwable e) {\n                    reportWtf(\"starting AssetAtlasService\", e);\n                }\n            }\n\n            if (!disableNonCoreServices) {\n                ServiceManager.addService(GraphicsStatsService.GRAPHICS_STATS_SERVICE,\n                        new GraphicsStatsService(context));\n            }\n\n            if (context.getResources().getBoolean(\n                    com.android.internal.R.bool.config_enableGestureService)) {\n                try {\n                    Slog.i(TAG, \"Gesture Sensor Service\");\n                    gestureService = new GestureService(context, inputManager);\n                    ServiceManager.addService(\"gesture\", gestureService);\n                } catch (Throwable e) {\n                    Slog.e(TAG, \"Failure starting Gesture Sensor Service\", e);\n                }\n            }\n\n            if (mPackageManager.hasSystemFeature(PackageManager.FEATURE_PRINTING)) {\n                mSystemServiceManager.startService(PRINT_MANAGER_SERVICE_CLASS);\n            }\n\n            mSystemServiceManager.startService(RestrictionsManagerService.class);\n\n            mSystemServiceManager.startService(MediaSessionService.class);\n\n            if (mPackageManager.hasSystemFeature(PackageManager.FEATURE_HDMI_CEC)) {\n                mSystemServiceManager.startService(HdmiControlService.class);\n            }\n\n            if (mPackageManager.hasSystemFeature(PackageManager.FEATURE_LIVE_TV)) {\n                mSystemServiceManager.startService(TvInputManagerService.class);\n            }\n\n            if (!disableNonCoreServices) {\n                try {\n                    Slog.i(TAG, \"Media Router Service\");\n                    mediaRouter = new MediaRouterService(context);\n                    ServiceManager.addService(Context.MEDIA_ROUTER_SERVICE, mediaRouter);\n                } catch (Throwable e) {\n                    reportWtf(\"starting MediaRouterService\", e);\n                }\n\n                mSystemServiceManager.startService(TrustManagerService.class);\n\n                mSystemServiceManager.startService(FingerprintService.class);\n\n                try {\n                    Slog.i(TAG, \"BackgroundDexOptService\");\n                    BackgroundDexOptService.schedule(context, 0);\n                } catch (Throwable e) {\n                    reportWtf(\"starting BackgroundDexOptService\", e);\n                }\n\n            }\n\n            mSystemServiceManager.startService(LauncherAppsService.class);\n        }\n\n        if (!disableNonCoreServices) {\n            mSystemServiceManager.startService(MediaProjectionManagerService.class);\n        }\n\n        // make sure the ADB_ENABLED setting value matches the secure property value\n        CMSettings.Secure.putInt(mContentResolver, CMSettings.Secure.ADB_PORT,\n                Integer.parseInt(SystemProperties.get(\"service.adb.tcp.port\", \"-1\")));\n\n        // register observer to listen for settings changes\n        mContentResolver.registerContentObserver(\n            CMSettings.Secure.getUriFor(CMSettings.Secure.ADB_PORT),\n            false, new AdbPortObserver());\n\n        // Before things start rolling, be sure we have decided whether\n        // we are in safe mode.\n        final boolean safeMode = wm.detectSafeMode();\n        if (safeMode) {\n            mActivityManagerService.enterSafeMode();\n            // Disable the JIT for the system_server process\n            VMRuntime.getRuntime().disableJitCompilation();\n        } else {\n            // Enable the JIT for the system_server process\n            VMRuntime.getRuntime().startJitCompilation();\n        }\n\n        // MMS service broker\n        mmsService = mSystemServiceManager.startService(MmsServiceBroker.class);\n\n        final Class<?> serverClazz;\n        try {\n            serverClazz = Class.forName(externalServer);\n            final Constructor<?> constructor = serverClazz.getDeclaredConstructor(Context.class);\n            constructor.setAccessible(true);\n            final Object baseObject = constructor.newInstance(mSystemContext);\n            final Method method = baseObject.getClass().getDeclaredMethod(\"run\");\n            method.setAccessible(true);\n            method.invoke(baseObject);\n        } catch (ClassNotFoundException\n                | IllegalAccessException\n                | InvocationTargetException\n                | InstantiationException\n                | NoSuchMethodException e) {\n            Slog.wtf(TAG, \"Unable to start  \" + externalServer);\n            Slog.wtf(TAG, e);\n        }\n\n        // It is now time to start up the app processes...\n\n        try {\n            vibrator.systemReady();\n        } catch (Throwable e) {\n            reportWtf(\"making Vibrator Service ready\", e);\n        }\n\n        if (lockSettings != null) {\n            try {\n                lockSettings.systemReady();\n            } catch (Throwable e) {\n                reportWtf(\"making Lock Settings Service ready\", e);\n            }\n        }\n\n        // Needed by DevicePolicyManager for initialization\n        mSystemServiceManager.startBootPhase(SystemService.PHASE_LOCK_SETTINGS_READY);\n\n        mSystemServiceManager.startBootPhase(SystemService.PHASE_SYSTEM_SERVICES_READY);\n\n        try {\n            wm.systemReady();\n        } catch (Throwable e) {\n            reportWtf(\"making Window Manager Service ready\", e);\n        }\n\n        if (safeMode) {\n            mActivityManagerService.showSafeModeOverlay();\n        }\n\n        // Update the configuration for this context by hand, because we're going\n        // to start using it before the config change done in wm.systemReady() will\n        // propagate to it.\n        Configuration config = wm.computeNewConfiguration();\n        DisplayMetrics metrics = new DisplayMetrics();\n        WindowManager w = (WindowManager)context.getSystemService(Context.WINDOW_SERVICE);\n        w.getDefaultDisplay().getMetrics(metrics);\n        context.getResources().updateConfiguration(config, metrics);\n\n        // The system context's theme may be configuration-dependent.\n        final Theme systemTheme = context.getTheme();\n        if (systemTheme.getChangingConfigurations() != 0) {\n            systemTheme.rebase();\n        }\n\n        try {\n            // TODO: use boot phase\n            mPowerManagerService.systemReady(mActivityManagerService.getAppOpsService());\n        } catch (Throwable e) {\n            reportWtf(\"making Power Manager Service ready\", e);\n        }\n\n        try {\n            mPackageManagerService.systemReady();\n        } catch (Throwable e) {\n            reportWtf(\"making Package Manager Service ready\", e);\n        }\n\n        try {\n            // TODO: use boot phase and communicate these flags some other way\n            mDisplayManagerService.systemReady(safeMode, mOnlyCore);\n        } catch (Throwable e) {\n            reportWtf(\"making Display Manager Service ready\", e);\n        }\n\n        if (gestureService != null) {\n            try {\n                gestureService.systemReady();\n            } catch (Throwable e) {\n                reportWtf(\"making Gesture Sensor Service ready\", e);\n            }\n        }\n\n        // These are needed to propagate to the runnable below.\n        final NetworkManagementService networkManagementF = networkManagement;\n        final NetworkStatsService networkStatsF = networkStats;\n        final NetworkPolicyManagerService networkPolicyF = networkPolicy;\n        final ConnectivityService connectivityF = connectivity;\n        final NetworkScoreService networkScoreF = networkScore;\n        final WallpaperManagerService wallpaperF = wallpaper;\n        final InputMethodManagerService immF = imm;\n        final LocationManagerService locationF = location;\n        final CountryDetectorService countryDetectorF = countryDetector;\n        final NetworkTimeUpdateService networkTimeUpdaterF = networkTimeUpdater;\n        final CommonTimeManagementService commonTimeMgmtServiceF = commonTimeMgmtService;\n        final TextServicesManagerService textServiceManagerServiceF = tsms;\n        final StatusBarManagerService statusBarF = statusBar;\n        final AssetAtlasService atlasF = atlas;\n        final InputManagerService inputManagerF = inputManager;\n        final TelephonyRegistry telephonyRegistryF = telephonyRegistry;\n        final MediaRouterService mediaRouterF = mediaRouter;\n        final AudioService audioServiceF = audioService;\n        final MmsServiceBroker mmsServiceF = mmsService;\n\n        // We now tell the activity manager it is okay to run third party\n        // code.  It will call back into us once it has gotten to the state\n        // where third party code can really run (but before it has actually\n        // started launching the initial applications), for us to complete our\n        // initialization.\n        mActivityManagerService.systemReady(new Runnable() {\n            @Override\n            public void run() {\n                Slog.i(TAG, \"Making services ready\");\n                mSystemServiceManager.startBootPhase(\n                        SystemService.PHASE_ACTIVITY_MANAGER_READY);\n\n                try {\n                    mActivityManagerService.startObservingNativeCrashes();\n                } catch (Throwable e) {\n                    reportWtf(\"observing native crashes\", e);\n                }\n\n                Slog.i(TAG, \"WebViewFactory preparation\");\n                WebViewFactory.prepareWebViewInSystemServer();\n\n                try {\n                    startSystemUi(context);\n                } catch (Throwable e) {\n                    reportWtf(\"starting System UI\", e);\n                }\n                try {\n                    if (networkScoreF != null) networkScoreF.systemReady();\n                } catch (Throwable e) {\n                    reportWtf(\"making Network Score Service ready\", e);\n                }\n                try {\n                    if (networkManagementF != null) networkManagementF.systemReady();\n                } catch (Throwable e) {\n                    reportWtf(\"making Network Managment Service ready\", e);\n                }\n                try {\n                    if (networkStatsF != null) networkStatsF.systemReady();\n                } catch (Throwable e) {\n                    reportWtf(\"making Network Stats Service ready\", e);\n                }\n                try {\n                    if (networkPolicyF != null) networkPolicyF.systemReady();\n                } catch (Throwable e) {\n                    reportWtf(\"making Network Policy Service ready\", e);\n                }\n                try {\n                    if (connectivityF != null) connectivityF.systemReady();\n                } catch (Throwable e) {\n                    reportWtf(\"making Connectivity Service ready\", e);\n                }\n                try {\n                    if (audioServiceF != null) audioServiceF.systemReady();\n                } catch (Throwable e) {\n                    reportWtf(\"Notifying AudioService running\", e);\n                }\n                Watchdog.getInstance().start();\n\n                // It is now okay to let the various system services start their\n                // third party code...\n                mSystemServiceManager.startBootPhase(\n                        SystemService.PHASE_THIRD_PARTY_APPS_CAN_START);\n\n                try {\n                    if (wallpaperF != null) wallpaperF.systemRunning();\n                } catch (Throwable e) {\n                    reportWtf(\"Notifying WallpaperService running\", e);\n                }\n                try {\n                    if (immF != null) immF.systemRunning(statusBarF);\n                } catch (Throwable e) {\n                    reportWtf(\"Notifying InputMethodService running\", e);\n                }\n                try {\n                    if (locationF != null) locationF.systemRunning();\n                } catch (Throwable e) {\n                    reportWtf(\"Notifying Location Service running\", e);\n                }\n                try {\n                    if (countryDetectorF != null) countryDetectorF.systemRunning();\n                } catch (Throwable e) {\n                    reportWtf(\"Notifying CountryDetectorService running\", e);\n                }\n                try {\n                    if (networkTimeUpdaterF != null) networkTimeUpdaterF.systemRunning();\n                } catch (Throwable e) {\n                    reportWtf(\"Notifying NetworkTimeService running\", e);\n                }\n                try {\n                    if (commonTimeMgmtServiceF != null) {\n                        commonTimeMgmtServiceF.systemRunning();\n                    }\n                } catch (Throwable e) {\n                    reportWtf(\"Notifying CommonTimeManagementService running\", e);\n                }\n                try {\n                    if (textServiceManagerServiceF != null)\n                        textServiceManagerServiceF.systemRunning();\n                } catch (Throwable e) {\n                    reportWtf(\"Notifying TextServicesManagerService running\", e);\n                }\n                try {\n                    if (atlasF != null) atlasF.systemRunning();\n                } catch (Throwable e) {\n                    reportWtf(\"Notifying AssetAtlasService running\", e);\n                }\n                try {\n                    // TODO(BT) Pass parameter to input manager\n                    if (inputManagerF != null) inputManagerF.systemRunning();\n                } catch (Throwable e) {\n                    reportWtf(\"Notifying InputManagerService running\", e);\n                }\n                try {\n                    if (telephonyRegistryF != null) telephonyRegistryF.systemRunning();\n                } catch (Throwable e) {\n                    reportWtf(\"Notifying TelephonyRegistry running\", e);\n                }\n                try {\n                    if (mediaRouterF != null) mediaRouterF.systemRunning();\n                } catch (Throwable e) {\n                    reportWtf(\"Notifying MediaRouterService running\", e);\n                }\n\n                try {\n                    if (mmsServiceF != null) mmsServiceF.systemRunning();\n                } catch (Throwable e) {\n                    reportWtf(\"Notifying MmsService running\", e);\n                }\n            }\n        });\n    }\n\n    static final void startSystemUi(Context context) {\n        Intent intent = new Intent();\n        intent.setComponent(new ComponentName(\"com.android.systemui\",\n                    \"com.android.systemui.SystemUIService\"));\n        //Slog.d(TAG, \"Starting service: \" + intent);\n        context.startServiceAsUser(intent, UserHandle.OWNER);\n    }\n}\n"
  },
  {
    "path": "VirtualPosition/vp_Framework/VirtualPositionService.java",
    "content": "package com.android.server;  \nimport android.content.Context;  \nimport android.os.IVirtualPositionService;  \nimport android.util.Slog;  \n\npublic class VirtualPositionService extends IVirtualPositionService.Stub {  \n    private static final String TAG = \"VirtualPositionService\";  \n    VirtualPositionService() {  \n        init_native();  \n    }  \n    public void setVirtualToggle(int tog) {\n        native_set_virtual_toggle(tog);\n    }\n\n    public int getVirtualToggle(){\n        return native_get_virtual_toggle();\n    }\n\n    public void setVirtualLatitude(double vlat) {\n        native_set_virtual_latitude(vlat);\n    }\n\n    public double getVirtualLatitude(){\n        return native_get_virtual_latitude();\n    }\n\n    public void setVirtualLongitude(double vlon) {\n        native_set_virtual_longitude(vlon);\n    }\n\n    public double getVirtualLongitude() {\n        return native_get_virtual_longitude();\n    }\n    \n    private static native boolean init_native();\n    private static native void native_set_virtual_toggle(int tog);\n    private static native int native_get_virtual_toggle();\n    private static native void native_set_virtual_latitude(double vlat);\n    private static native double native_get_virtual_latitude();\n    private static native void native_set_virtual_longitude(double vlon);\n    private static native double native_get_virtual_longitude();\n\n};  \n"
  },
  {
    "path": "VirtualPosition/vp_Framework/sepolicy/device.te",
    "content": "# Device types\ntype device, dev_type, fs_type;\ntype alarm_device, dev_type, mlstrustedobject;\ntype adb_device, dev_type;\ntype ashmem_device, dev_type, mlstrustedobject;\ntype audio_device, dev_type;\ntype binder_device, dev_type, mlstrustedobject;\ntype block_device, dev_type;\ntype camera_device, dev_type;\ntype dm_device, dev_type;\ntype loop_device, dev_type;\ntype pmsg_device, dev_type, mlstrustedobject;\ntype radio_device, dev_type;\ntype ram_device, dev_type;\ntype rtc_device, dev_type;\ntype vold_device, dev_type;\ntype console_device, dev_type;\ntype cpuctl_device, dev_type;\ntype fscklogs, dev_type;\ntype full_device, dev_type;\n# GPU (used by most UI apps)\ntype gpu_device, dev_type, mlstrustedobject;\ntype graphics_device, dev_type;\ntype hw_random_device, dev_type;\ntype input_device, dev_type;\ntype kmem_device, dev_type;\ntype log_device, dev_type, mlstrustedobject;\ntype mtd_device, dev_type;\ntype mtp_device, dev_type, mlstrustedobject;\ntype nfc_device, dev_type;\ntype ptmx_device, dev_type, mlstrustedobject;\ntype kmsg_device, dev_type;\ntype null_device, dev_type, mlstrustedobject;\ntype random_device, dev_type, mlstrustedobject;\ntype sensors_device, dev_type;\ntype serial_device, dev_type;\ntype socket_device, dev_type;\ntype owntty_device, dev_type, mlstrustedobject;\ntype tty_device, dev_type;\ntype urandom_device, dev_type, mlstrustedobject;\ntype video_device, dev_type;\ntype vcs_device, dev_type;\ntype zero_device, dev_type, mlstrustedobject;\ntype fuse_device, dev_type;\ntype iio_device, dev_type;\ntype ion_device, dev_type, mlstrustedobject;\ntype gps_device, dev_type;\ntype qtaguid_device, dev_type;\ntype watchdog_device, dev_type;\ntype uhid_device, dev_type;\ntype uio_device, dev_type;\ntype tun_device, dev_type, mlstrustedobject;\ntype usbaccessory_device, dev_type, mlstrustedobject;\ntype usb_device, dev_type, mlstrustedobject;\ntype klog_device, dev_type;\ntype properties_device, dev_type;\n\n# All devices have a uart for the hci\n# attach service. The uart dev node\n# varies per device. This type\n# is used in per device policy\ntype hci_attach_dev, dev_type;\n\n# All devices have a rpmsg device for\n# achieving remoteproc and rpmsg modules\ntype rpmsg_device, dev_type;\n\n# Partition layout block device\ntype root_block_device, dev_type;\n\n# factory reset protection block device\ntype frp_block_device, dev_type;\n\n# System block device mounted on /system.\ntype system_block_device, dev_type;\n\n# Recovery block device.\ntype recovery_block_device, dev_type;\n\n# boot block device.\ntype boot_block_device, dev_type;\n\n# Userdata block device mounted on /data.\ntype userdata_block_device, dev_type;\n\n# Cache block device mounted on /cache.\ntype cache_block_device, dev_type;\n\n# Block device for any swap partition.\ntype swap_block_device, dev_type;\n\n# Metadata block device used for encryption metadata.\n# Assign this type to the partition specified by the encryptable=\n# mount option in your fstab file in the entry for userdata.\ntype metadata_block_device, dev_type;\n\n# add by aggresss\ntype vp_device, dev_type;\n"
  },
  {
    "path": "VirtualPosition/vp_Framework/sepolicy/file_contexts",
    "content": "###########################################\n# Root\n/\t\t\tu:object_r:rootfs:s0\n\n# Data files\n/adb_keys\t\tu:object_r:adb_keys_file:s0\n/default\\.prop\t\tu:object_r:rootfs:s0\n/fstab\\..*\t\tu:object_r:rootfs:s0\n/init\\..*\t\tu:object_r:rootfs:s0\n/res(/.*)?\t\tu:object_r:rootfs:s0\n/ueventd\\..*\t\tu:object_r:rootfs:s0\n\n# Executables\n/charger\t\tu:object_r:rootfs:s0\n/init\t\t\tu:object_r:init_exec:s0\n/sbin(/.*)?\t\tu:object_r:rootfs:s0\n\n# Empty directories\n/lost\\+found\t\tu:object_r:rootfs:s0\n/proc\t\t\tu:object_r:rootfs:s0\n\n# SELinux policy files\n/file_contexts\t\tu:object_r:rootfs:s0\n/property_contexts\tu:object_r:rootfs:s0\n/seapp_contexts\t\tu:object_r:rootfs:s0\n/sepolicy\t\tu:object_r:rootfs:s0\n\n##########################\n# Devices\n#\n/dev(/.*)?\t\tu:object_r:device:s0\n/dev/akm8973.*\t\tu:object_r:sensors_device:s0\n/dev/accelerometer\tu:object_r:sensors_device:s0\n/dev/adf[0-9]*\t\tu:object_r:graphics_device:s0\n/dev/adf-interface[0-9]*\\.[0-9]*\tu:object_r:graphics_device:s0\n/dev/adf-overlay-engine[0-9]*\\.[0-9]*\tu:object_r:graphics_device:s0\n/dev/alarm\t\tu:object_r:alarm_device:s0\n/dev/android_adb.*\tu:object_r:adb_device:s0\n/dev/ashmem\t\tu:object_r:ashmem_device:s0\n/dev/audio.*\t\tu:object_r:audio_device:s0\n/dev/binder\t\tu:object_r:binder_device:s0\n/dev/block(/.*)?\tu:object_r:block_device:s0\n/dev/block/dm-[0-9]+\tu:object_r:dm_device:s0\n/dev/block/loop[0-9]*\tu:object_r:loop_device:s0\n/dev/block/vold/.+\tu:object_r:vold_device:s0\n/dev/block/ram[0-9]*\tu:object_r:ram_device:s0\n/dev/bus/usb(.*)?       u:object_r:usb_device:s0\n/dev/cam\t\tu:object_r:camera_device:s0\n/dev/console\t\tu:object_r:console_device:s0\n/dev/cpuctl(/.*)?\tu:object_r:cpuctl_device:s0\n/dev/device-mapper\tu:object_r:dm_device:s0\n/dev/eac\t\tu:object_r:audio_device:s0\n/dev/fscklogs(/.*)?\tu:object_r:fscklogs:s0\n/dev/full\t\tu:object_r:full_device:s0\n/dev/fuse\t\tu:object_r:fuse_device:s0\n/dev/graphics(/.*)?\tu:object_r:graphics_device:s0\n/dev/hw_random\t\tu:object_r:hw_random_device:s0\n/dev/input(/.*)\t\tu:object_r:input_device:s0\n/dev/iio:device[0-9]+   u:object_r:iio_device:s0\n/dev/ion\t\tu:object_r:ion_device:s0\n/dev/kmem\t\tu:object_r:kmem_device:s0\n/dev/log(/.*)?\t\tu:object_r:log_device:s0\n/dev/mem\t\tu:object_r:kmem_device:s0\n/dev/modem.*\t\tu:object_r:radio_device:s0\n/dev/mpu\t\tu:object_r:gps_device:s0\n/dev/mpuirq\t\tu:object_r:gps_device:s0\n/dev/mtd(/.*)?\t\tu:object_r:mtd_device:s0\n/dev/mtp_usb\t\tu:object_r:mtp_device:s0\n/dev/pmsg0\t\tu:object_r:pmsg_device:s0\n/dev/pn544\t\tu:object_r:nfc_device:s0\n/dev/ppp\t\tu:object_r:ppp_device:s0\n/dev/ptmx\t\tu:object_r:ptmx_device:s0\n/dev/pvrsrvkm\t\tu:object_r:gpu_device:s0\n/dev/kmsg\t\tu:object_r:kmsg_device:s0\n/dev/null\t\tu:object_r:null_device:s0\n/dev/nvhdcp1\t\tu:object_r:video_device:s0\n/dev/random\t\tu:object_r:random_device:s0\n/dev/rpmsg-omx[0-9]\tu:object_r:rpmsg_device:s0\n/dev/rproc_user\tu:object_r:rpmsg_device:s0\n/dev/rtc[0-9]      u:object_r:rtc_device:s0\n/dev/snd(/.*)?\t\tu:object_r:audio_device:s0\n/dev/socket(/.*)?\tu:object_r:socket_device:s0\n/dev/socket/adbd\tu:object_r:adbd_socket:s0\n/dev/socket/sap_uim_socket[0-9]        u:object_r:sap_uim_socket:s0\n/dev/socket/cryptd\tu:object_r:vold_socket:s0\n/dev/socket/dnsproxyd\tu:object_r:dnsproxyd_socket:s0\n/dev/socket/dumpstate\tu:object_r:dumpstate_socket:s0\n/dev/socket/fwmarkd\tu:object_r:fwmarkd_socket:s0\n/dev/socket/gps\t\tu:object_r:gps_socket:s0\n/dev/socket/installd\tu:object_r:installd_socket:s0\n/dev/socket/lmkd        u:object_r:lmkd_socket:s0\n/dev/socket/logd\tu:object_r:logd_socket:s0\n/dev/socket/logdr\tu:object_r:logdr_socket:s0\n/dev/socket/logdw\tu:object_r:logdw_socket:s0\n/dev/socket/mdns\tu:object_r:mdns_socket:s0\n/dev/socket/mdnsd\tu:object_r:mdnsd_socket:s0\n/dev/socket/mtpd\tu:object_r:mtpd_socket:s0\n/dev/socket/netd\tu:object_r:netd_socket:s0\n/dev/socket/property_service\tu:object_r:property_socket:s0\n/dev/socket/racoon\tu:object_r:racoon_socket:s0\n/dev/socket/rild\tu:object_r:rild_socket:s0\n/dev/socket/rild-debug\tu:object_r:rild_debug_socket:s0\n/dev/socket/vold\tu:object_r:vold_socket:s0\n/dev/socket/wpa_eth[0-9] u:object_r:wpa_socket:s0\n/dev/socket/wpa_wlan[0-9] u:object_r:wpa_socket:s0\n/dev/socket/zygote\tu:object_r:zygote_socket:s0\n/dev/socket/zygote_secondary\tu:object_r:zygote_socket:s0\n/dev/spdif_out.*\tu:object_r:audio_device:s0\n/dev/tegra.*\t\tu:object_r:video_device:s0\n/dev/tf_driver\t\tu:object_r:tee_device:s0\n/dev/tty\t\tu:object_r:owntty_device:s0\n/dev/tty[0-9]*\t\tu:object_r:tty_device:s0\n/dev/ttyS[0-9]*\t\tu:object_r:serial_device:s0\n/dev/tun\t\tu:object_r:tun_device:s0\n/dev/uhid\t\tu:object_r:uhid_device:s0\n/dev/uinput\t\tu:object_r:uhid_device:s0\n/dev/uio[0-9]*\t\tu:object_r:uio_device:s0\n/dev/urandom\t\tu:object_r:urandom_device:s0\n/dev/usb_accessory\tu:object_r:usbaccessory_device:s0\n/dev/vcs[0-9a-z]*\tu:object_r:vcs_device:s0\n/dev/video[0-9]*\tu:object_r:video_device:s0\n/dev/watchdog\t\tu:object_r:watchdog_device:s0\n/dev/xt_qtaguid\tu:object_r:qtaguid_device:s0\n/dev/zero\t\tu:object_r:zero_device:s0\n/dev/__kmsg__\t\tu:object_r:klog_device:s0\n/dev/__properties__ u:object_r:properties_device:s0\n# add by aggresss\n/dev/vp             u:object_r:vp_device:s0\n\n#############################\n# System files\n#\n/system(/.*)?\t\tu:object_r:system_file:s0\n/system/bin/e2fsck\t--\tu:object_r:fsck_exec:s0\n/system/bin/fsck\\.f2fs\t--\tu:object_r:fsck_exec:s0\n/system/bin/fsck_msdos\t--\tu:object_r:fsck_exec:s0\n/system/bin/toolbox\t--\tu:object_r:toolbox_exec:s0\n/system/bin/toybox\t--\tu:object_r:toolbox_exec:s0\n/system/bin/logcat\t--\tu:object_r:logcat_exec:s0\n/system/bin/sh\t\t--\tu:object_r:shell_exec:s0\n/system/bin/run-as\t--\tu:object_r:runas_exec:s0\n/system/bin/bootanimation u:object_r:bootanim_exec:s0\n/system/bin/app_process32\tu:object_r:zygote_exec:s0\n/system/bin/app_process64\tu:object_r:zygote_exec:s0\n/system/bin/servicemanager\tu:object_r:servicemanager_exec:s0\n/system/bin/surfaceflinger\tu:object_r:surfaceflinger_exec:s0\n/system/bin/drmserver\tu:object_r:drmserver_exec:s0\n/system/bin/dumpstate   u:object_r:dumpstate_exec:s0\n/system/bin/vold\tu:object_r:vold_exec:s0\n/system/bin/netd\tu:object_r:netd_exec:s0\n/system/bin/rild\tu:object_r:rild_exec:s0\n/system/bin/mediaserver\tu:object_r:mediaserver_exec:s0\n/system/bin/mdnsd\tu:object_r:mdnsd_exec:s0\n/system/bin/installd\tu:object_r:installd_exec:s0\n/system/bin/keystore\tu:object_r:keystore_exec:s0\n/system/bin/fingerprintd u:object_r:fingerprintd_exec:s0\n/system/bin/gatekeeperd u:object_r:gatekeeperd_exec:s0\n/system/bin/debuggerd\tu:object_r:debuggerd_exec:s0\n/system/bin/debuggerd64\tu:object_r:debuggerd_exec:s0\n/system/bin/wpa_supplicant\tu:object_r:wpa_exec:s0\n/system/bin/sdcard      u:object_r:sdcardd_exec:s0\n/system/bin/dhcpcd      u:object_r:dhcp_exec:s0\n/system/bin/mtpd\tu:object_r:mtp_exec:s0\n/system/bin/pppd\tu:object_r:ppp_exec:s0\n/system/bin/tf_daemon\tu:object_r:tee_exec:s0\n/system/bin/racoon\tu:object_r:racoon_exec:s0\n/system/xbin/su\t\tu:object_r:su_exec:s0\n/system/xbin/procrank   u:object_r:procrank_exec:s0\n/system/xbin/perfprofd  u:object_r:perfprofd_exec:s0\n/system/xbin/simpleperf u:object_r:system_file:s0\n/system/vendor/bin/gpsd u:object_r:gpsd_exec:s0\n/system/bin/dnsmasq     u:object_r:dnsmasq_exec:s0\n/system/bin/hostapd     u:object_r:hostapd_exec:s0\n/system/bin/clatd\tu:object_r:clatd_exec:s0\n/system/bin/lmkd        u:object_r:lmkd_exec:s0\n/system/bin/inputflinger u:object_r:inputflinger_exec:s0\n/system/bin/logd        u:object_r:logd_exec:s0\n/system/bin/uncrypt     u:object_r:uncrypt_exec:s0\n/system/bin/logwrapper  u:object_r:system_file:s0\n/system/bin/vdc         u:object_r:vdc_exec:s0\n/system/bin/install-recovery.sh u:object_r:install_recovery_exec:s0\n/system/bin/dex2oat     u:object_r:dex2oat_exec:s0\n# patchoat executable has (essentially) the same requirements as dex2oat.\n/system/bin/patchoat    u:object_r:dex2oat_exec:s0\n/system/bin/sgdisk      u:object_r:sgdisk_exec:s0\n/system/bin/blkid       u:object_r:blkid_exec:s0\n/system/bin/tzdatacheck u:object_r:tzdatacheck_exec:s0\n\n#############################\n# Vendor files\n#\n/vendor(/.*)?\t\tu:object_r:system_file:s0\n/vendor/bin/gpsd\tu:object_r:gpsd_exec:s0\n\n#############################\n# OEM and ODM files\n#\n/odm(/.*)?              u:object_r:system_file:s0\n/oem(/.*)?              u:object_r:oemfs:s0\n\n\n#############################\n# Data files\n#\n# NOTE: When modifying existing label rules, changes may also need to\n# propagate to the \"Expanded data files\" section.\n#\n/data(/.*)?\t\tu:object_r:system_data_file:s0\n/data/.layout_version\t\tu:object_r:install_data_file:s0\n/data/unencrypted(/.*)?         u:object_r:unencrypted_data_file:s0\n/data/backup(/.*)?\t\tu:object_r:backup_data_file:s0\n/data/secure/backup(/.*)?\tu:object_r:backup_data_file:s0\n/data/security(/.*)?\tu:object_r:security_file:s0\n/data/system/ndebugsocket\tu:object_r:system_ndebug_socket:s0\n/data/drm(/.*)?\t\tu:object_r:drm_data_file:s0\n/data/gps(/.*)?\t\tu:object_r:gps_data_file:s0\n/data/resource-cache(/.*)? u:object_r:resourcecache_data_file:s0\n/data/dalvik-cache(/.*)? u:object_r:dalvikcache_data_file:s0\n/data/dalvik-cache/profiles(/.*)? u:object_r:dalvikcache_profiles_data_file:s0\n/data/adb(/.*)?\t\tu:object_r:adb_data_file:s0\n/data/anr(/.*)?\t\tu:object_r:anr_data_file:s0\n/data/app(/.*)?                       u:object_r:apk_data_file:s0\n/data/app/[^/]+/oat(/.*)?                u:object_r:dalvikcache_data_file:s0\n/data/app/vmdl[^/]+\\.tmp(/.*)?           u:object_r:apk_tmp_file:s0\n/data/app/vmdl[^/]+\\.tmp/oat(/.*)?           u:object_r:dalvikcache_data_file:s0\n/data/app-private(/.*)?               u:object_r:apk_private_data_file:s0\n/data/app-private/vmdl.*\\.tmp(/.*)?   u:object_r:apk_private_tmp_file:s0\n/data/tombstones(/.*)?\tu:object_r:tombstone_data_file:s0\n/data/local/tmp(/.*)?\tu:object_r:shell_data_file:s0\n/data/media(/.*)?\tu:object_r:media_rw_data_file:s0\n/data/mediadrm(/.*)?\tu:object_r:media_data_file:s0\n/data/property(/.*)?\tu:object_r:property_data_file:s0\n\n# Misc data\n/data/misc/adb(/.*)?            u:object_r:adb_keys_file:s0\n/data/misc/audio(/.*)?          u:object_r:audio_data_file:s0\n/data/misc/bluetooth(/.*)?      u:object_r:bluetooth_data_file:s0\n/data/misc/bluedroid(/.*)?      u:object_r:bluetooth_data_file:s0\n/data/misc/bluedroid/\\.a2dp_ctrl u:object_r:bluetooth_socket:s0\n/data/misc/bluedroid/\\.a2dp_data u:object_r:bluetooth_socket:s0\n/data/misc/camera(/.*)?         u:object_r:camera_data_file:s0\n/data/misc/dhcp(/.*)?           u:object_r:dhcp_data_file:s0\n/data/misc/gatekeeper(/.*)?     u:object_r:gatekeeper_data_file:s0\n/data/misc/keychain(/.*)?       u:object_r:keychain_data_file:s0\n/data/misc/keystore(/.*)?       u:object_r:keystore_data_file:s0\n/data/misc/logd(/.*)?           u:object_r:misc_logd_file:s0\n/data/misc/media(/.*)?          u:object_r:media_data_file:s0\n/data/misc/net(/.*)?            u:object_r:net_data_file:s0\n/data/misc/shared_relro(/.*)?   u:object_r:shared_relro_file:s0\n/data/misc/sms(/.*)?            u:object_r:radio_data_file:s0\n/data/misc/systemkeys(/.*)?     u:object_r:systemkeys_data_file:s0\n/data/misc/user(/.*)?           u:object_r:misc_user_data_file:s0\n/data/misc/vpn(/.*)?            u:object_r:vpn_data_file:s0\n/data/misc/wifi(/.*)?           u:object_r:wifi_data_file:s0\n/data/misc/wifi/sockets(/.*)?   u:object_r:wpa_socket:s0\n/data/misc/wifi/sockets/wpa_ctrl.*   u:object_r:system_wpa_socket:s0\n/data/misc/wifi/hostapd(/.*)?   u:object_r:wpa_socket:s0\n/data/misc/zoneinfo(/.*)?       u:object_r:zoneinfo_data_file:s0\n/data/misc/vold(/.*)?           u:object_r:vold_data_file:s0\n/data/misc/perfprofd(/.*)?      u:object_r:perfprofd_data_file:s0\n/data/system/heapdump(/.*)?     u:object_r:heapdump_data_file:s0\n\n# Fingerprint data\n/data/system/users/[0-9]+/fpdata(/.*)? u:object_r:fingerprintd_data_file:s0\n\n# Bootchart data\n/data/bootchart(/.*)?\t\tu:object_r:bootchart_data_file:s0\n\n#############################\n# Expanded data files\n#\n/mnt/expand(/.*)?                                   u:object_r:mnt_expand_file:s0\n/mnt/expand/[^/]+(/.*)?                             u:object_r:system_data_file:s0\n/mnt/expand/[^/]+/app(/.*)?                         u:object_r:apk_data_file:s0\n/mnt/expand/[^/]+/app/[^/]+/oat(/.*)?               u:object_r:dalvikcache_data_file:s0\n/mnt/expand/[^/]+/app/vmdl[^/]+\\.tmp(/.*)?          u:object_r:apk_tmp_file:s0\n/mnt/expand/[^/]+/app/vmdl[^/]+\\.tmp/oat(/.*)?      u:object_r:dalvikcache_data_file:s0\n/mnt/expand/[^/]+/local/tmp(/.*)?                   u:object_r:shell_data_file:s0\n/mnt/expand/[^/]+/media(/.*)?                       u:object_r:media_rw_data_file:s0\n/mnt/expand/[^/]+/misc/vold(/.*)?                   u:object_r:vold_data_file:s0\n\n# coredump directory for userdebug/eng devices\n/cores(/.*)?                    u:object_r:coredump_file:s0\n\n# Wallpaper file for other users\n/data/system/users/[0-9]+/wallpaper\t\tu:object_r:wallpaper_file:s0\n#############################\n# efs files\n#\n/efs(/.*)?\t\tu:object_r:efs_file:s0\n#############################\n# Cache files\n#\n/cache(/.*)?\t\tu:object_r:cache_file:s0\n/cache/.*\\.data\tu:object_r:cache_backup_file:s0\n/cache/.*\\.restore\tu:object_r:cache_backup_file:s0\n# LocalTransport (backup) uses this directory\n/cache/backup(/.*)?\tu:object_r:cache_backup_file:s0\n#############################\n# sysfs files\n#\n/sys/devices/platform/nfc-power/nfc_power -- u:object_r:sysfs_nfc_power_writable:s0\n/sys/devices/system/cpu(/.*)?    u:object_r:sysfs_devices_system_cpu:s0\n/sys/power/wake_lock -- u:object_r:sysfs_wake_lock:s0\n/sys/power/wake_unlock -- u:object_r:sysfs_wake_lock:s0\n/sys/kernel/uevent_helper --\tu:object_r:usermodehelper:s0\n/sys/module/lowmemorykiller(/.*)? -- u:object_r:sysfs_lowmemorykiller:s0\n\n#############################\n# asec containers\n/mnt/asec(/.*)?             u:object_r:asec_apk_file:s0\n/mnt/asec/[^/]+/[^/]+\\.zip  u:object_r:asec_public_file:s0\n/mnt/asec/[^/]+/lib(/.*)?   u:object_r:asec_public_file:s0\n/data/app-asec(/.*)?        u:object_r:asec_image_file:s0\n\n#############################\n# external storage\n/mnt/media_rw(/.*)?         u:object_r:mnt_media_rw_file:s0\n/mnt/user(/.*)?             u:object_r:mnt_user_file:s0\n/mnt/runtime(/.*)?          u:object_r:storage_file:s0\n/storage(/.*)?              u:object_r:storage_file:s0\n"
  },
  {
    "path": "VirtualPosition/vp_Framework/sepolicy/service.te",
    "content": "type bluetooth_service,         service_manager_type;\ntype default_android_service,   service_manager_type;\ntype drmserver_service,         service_manager_type;\ntype gatekeeper_service,        app_api_service, service_manager_type;\ntype fingerprintd_service,      service_manager_type;\ntype healthd_service,           service_manager_type;\ntype inputflinger_service,      service_manager_type;\ntype keystore_service,          service_manager_type;\ntype mediaserver_service,       service_manager_type;\ntype nfc_service,               service_manager_type;\ntype radio_service,             service_manager_type;\ntype surfaceflinger_service,    service_manager_type;\ntype system_app_service,        service_manager_type;\n\n# system_server_services broken down\ntype accessibility_service, app_api_service, system_server_service, service_manager_type;\ntype account_service, app_api_service, system_server_service, service_manager_type;\ntype activity_service, app_api_service, system_server_service, service_manager_type;\ntype alarm_service, app_api_service, system_server_service, service_manager_type;\ntype appops_service, app_api_service, system_server_service, service_manager_type;\ntype appwidget_service, app_api_service, system_server_service, service_manager_type;\ntype assetatlas_service, app_api_service, system_server_service, service_manager_type;\ntype audio_service, app_api_service, system_server_service, service_manager_type;\ntype backup_service, app_api_service, system_server_service, service_manager_type;\ntype batterystats_service, app_api_service, system_server_service, service_manager_type;\ntype battery_service, system_server_service, service_manager_type;\ntype bluetooth_manager_service, system_api_service, system_server_service, service_manager_type;\ntype cameraproxy_service, system_server_service, service_manager_type;\ntype clipboard_service, app_api_service, system_server_service, service_manager_type;\ntype IProxyService_service, system_api_service, system_server_service, service_manager_type;\ntype commontime_management_service, system_server_service, service_manager_type;\ntype connectivity_service, app_api_service, system_server_service, service_manager_type;\ntype consumer_ir_service, app_api_service, system_server_service, service_manager_type;\ntype content_service, app_api_service, system_server_service, service_manager_type;\ntype country_detector_service, system_api_service, system_server_service, service_manager_type;\ntype cpuinfo_service, system_api_service, system_server_service, service_manager_type;\ntype dbinfo_service, system_api_service, system_server_service, service_manager_type;\ntype device_policy_service, app_api_service, system_server_service, service_manager_type;\ntype deviceidle_service, system_api_service, system_server_service, service_manager_type;\ntype devicestoragemonitor_service, system_server_service, service_manager_type;\ntype diskstats_service, system_api_service, system_server_service, service_manager_type;\ntype display_service, app_api_service, system_server_service, service_manager_type;\ntype DockObserver_service, system_server_service, service_manager_type;\ntype dreams_service, system_api_service, system_server_service, service_manager_type;\ntype dropbox_service, app_api_service, system_server_service, service_manager_type;\ntype ethernet_service, app_api_service, system_server_service, service_manager_type;\ntype fingerprint_service, app_api_service, system_server_service, service_manager_type;\ntype gfxinfo_service, system_api_service, system_server_service, service_manager_type;\ntype graphicsstats_service, app_api_service, system_server_service, service_manager_type;\ntype hardware_service, system_server_service, service_manager_type;\ntype hdmi_control_service, system_api_service, system_server_service, service_manager_type;\ntype input_method_service, app_api_service, system_server_service, service_manager_type;\ntype input_service, app_api_service, system_server_service, service_manager_type;\ntype imms_service, app_api_service, system_server_service, service_manager_type;\ntype jobscheduler_service, app_api_service, system_server_service, service_manager_type;\ntype launcherapps_service, app_api_service, system_server_service, service_manager_type;\ntype location_service, app_api_service, system_server_service, service_manager_type;\ntype lock_settings_service, system_api_service, system_server_service, service_manager_type;\ntype media_projection_service, app_api_service, system_server_service, service_manager_type;\ntype media_router_service, app_api_service, system_server_service, service_manager_type;\ntype media_session_service, app_api_service, system_server_service, service_manager_type;\ntype meminfo_service, system_api_service, system_server_service, service_manager_type;\ntype midi_service, app_api_service, system_server_service, service_manager_type;\ntype mount_service, app_api_service, system_server_service, service_manager_type;\ntype netpolicy_service, app_api_service, system_server_service, service_manager_type;\ntype netstats_service, system_api_service, system_server_service, service_manager_type;\ntype network_management_service, system_api_service, system_server_service, service_manager_type;\ntype network_score_service, system_api_service, system_server_service, service_manager_type;\ntype notification_service, app_api_service, system_server_service, service_manager_type;\ntype package_service, app_api_service, system_server_service, service_manager_type;\ntype permission_service, app_api_service, system_server_service, service_manager_type;\ntype persistent_data_block_service, system_api_service, system_server_service, service_manager_type;\ntype power_service, app_api_service, system_server_service, service_manager_type;\ntype print_service, app_api_service, system_server_service, service_manager_type;\ntype processinfo_service, system_server_service, service_manager_type;\ntype procstats_service, app_api_service, system_server_service, service_manager_type;\ntype registry_service, app_api_service, system_server_service, service_manager_type;\ntype restrictions_service, app_api_service, system_server_service, service_manager_type;\ntype rttmanager_service, app_api_service, system_server_service, service_manager_type;\ntype samplingprofiler_service, system_server_service, service_manager_type;\ntype scheduling_policy_service, system_server_service, service_manager_type;\ntype search_service, app_api_service, system_server_service, service_manager_type;\ntype sensorservice_service, app_api_service, system_server_service, service_manager_type;\ntype serial_service, system_api_service, system_server_service, service_manager_type;\ntype servicediscovery_service, app_api_service, system_server_service, service_manager_type;\ntype statusbar_service, app_api_service, system_server_service, service_manager_type;\ntype task_service, system_server_service, service_manager_type;\ntype textservices_service, app_api_service, system_server_service, service_manager_type;\ntype telecom_service, app_api_service, system_server_service, service_manager_type;\ntype trust_service, system_api_service, system_server_service, service_manager_type;\ntype tv_input_service, app_api_service, system_server_service, service_manager_type;\ntype uimode_service, app_api_service, system_server_service, service_manager_type;\ntype updatelock_service, system_api_service, system_server_service, service_manager_type;\ntype usagestats_service, app_api_service, system_server_service, service_manager_type;\ntype usb_service, app_api_service, system_server_service, service_manager_type;\ntype user_service, app_api_service, system_server_service, service_manager_type;\ntype vibrator_service, app_api_service, system_server_service, service_manager_type;\ntype voiceinteraction_service, app_api_service, system_server_service, service_manager_type;\ntype wallpaper_service, app_api_service, system_server_service, service_manager_type;\ntype webviewupdate_service, system_api_service, system_server_service, service_manager_type;\ntype wifip2p_service, app_api_service, system_server_service, service_manager_type;\ntype wifiscanner_service, system_api_service, system_server_service, service_manager_type;\ntype wifi_service, app_api_service, system_server_service, service_manager_type;\ntype window_service, system_api_service, system_server_service, service_manager_type;\n# add by aggresss\ntype virtualposition_service, system_api_service, system_server_service, service_manager_type;\n"
  },
  {
    "path": "VirtualPosition/vp_Framework/sepolicy/service_contexts",
    "content": "accessibility                             u:object_r:accessibility_service:s0\naccount                                   u:object_r:account_service:s0\nactivity                                  u:object_r:activity_service:s0\nalarm                                     u:object_r:alarm_service:s0\nandroid.security.keystore                 u:object_r:keystore_service:s0\nandroid.service.gatekeeper.IGateKeeperService    u:object_r:gatekeeper_service:s0\nappops                                    u:object_r:appops_service:s0\nappwidget                                 u:object_r:appwidget_service:s0\nassetatlas                                u:object_r:assetatlas_service:s0\naudio                                     u:object_r:audio_service:s0\nbackup                                    u:object_r:backup_service:s0\nbatteryproperties                         u:object_r:healthd_service:s0\nbatterypropreg                            u:object_r:healthd_service:s0\nbatterystats                              u:object_r:batterystats_service:s0\nbattery                                   u:object_r:battery_service:s0\nbluetooth_manager                         u:object_r:bluetooth_manager_service:s0\nbluetooth                                 u:object_r:bluetooth_service:s0\ncarrier_config                            u:object_r:radio_service:s0\nclipboard                                 u:object_r:clipboard_service:s0\ncom.android.net.IProxyService             u:object_r:IProxyService_service:s0\ncommontime_management                     u:object_r:commontime_management_service:s0\ncommon_time.clock                        u:object_r:mediaserver_service:s0\ncommon_time.config                       u:object_r:mediaserver_service:s0\nconnectivity                              u:object_r:connectivity_service:s0\nconsumer_ir                               u:object_r:consumer_ir_service:s0\ncontent                                   u:object_r:content_service:s0\ncountry_detector                          u:object_r:country_detector_service:s0\ncpuinfo                                   u:object_r:cpuinfo_service:s0\ndbinfo                                    u:object_r:dbinfo_service:s0\ndevice_policy                             u:object_r:device_policy_service:s0\ndeviceidle                                u:object_r:deviceidle_service:s0\ndevicestoragemonitor                      u:object_r:devicestoragemonitor_service:s0\ndiskstats                                 u:object_r:diskstats_service:s0\ndisplay.qservice                          u:object_r:surfaceflinger_service:s0\ndisplay                                   u:object_r:display_service:s0\nDockObserver                              u:object_r:DockObserver_service:s0\ndreams                                    u:object_r:dreams_service:s0\ndrm.drmManager                            u:object_r:drmserver_service:s0\ndropbox                                   u:object_r:dropbox_service:s0\nethernet                                  u:object_r:ethernet_service:s0\nfingerprint                               u:object_r:fingerprint_service:s0\nandroid.hardware.fingerprint.IFingerprintDaemon u:object_r:fingerprintd_service:s0\ngfxinfo                                   u:object_r:gfxinfo_service:s0\ngraphicsstats                             u:object_r:graphicsstats_service:s0\nhardware                                  u:object_r:hardware_service:s0\nhdmi_control                              u:object_r:hdmi_control_service:s0\ninputflinger                              u:object_r:inputflinger_service:s0\ninput_method                              u:object_r:input_method_service:s0\ninput                                     u:object_r:input_service:s0\niphonesubinfo_msim                        u:object_r:radio_service:s0\niphonesubinfo2                            u:object_r:radio_service:s0\niphonesubinfo                             u:object_r:radio_service:s0\nims                                       u:object_r:radio_service:s0\nimms                                      u:object_r:imms_service:s0\nisms_msim                                 u:object_r:radio_service:s0\nisms2                                     u:object_r:radio_service:s0\nisms                                      u:object_r:radio_service:s0\nisub                                      u:object_r:radio_service:s0\njobscheduler                              u:object_r:jobscheduler_service:s0\nlauncherapps                              u:object_r:launcherapps_service:s0\nlocation                                  u:object_r:location_service:s0\nlock_settings                             u:object_r:lock_settings_service:s0\nmedia.audio_flinger                       u:object_r:mediaserver_service:s0\nmedia.audio_policy                        u:object_r:mediaserver_service:s0\nmedia.camera                              u:object_r:mediaserver_service:s0\nmedia.camera.proxy                        u:object_r:cameraproxy_service:s0\nmedia.log                                 u:object_r:mediaserver_service:s0\nmedia.player                              u:object_r:mediaserver_service:s0\nmedia.resource_manager                    u:object_r:mediaserver_service:s0\nmedia.radio                               u:object_r:mediaserver_service:s0\nmedia.sound_trigger_hw                    u:object_r:mediaserver_service:s0\nmedia_projection                          u:object_r:media_projection_service:s0\nmedia_router                              u:object_r:media_router_service:s0\nmedia_session                             u:object_r:media_session_service:s0\nmeminfo                                   u:object_r:meminfo_service:s0\nmidi                                      u:object_r:midi_service:s0\nmount                                     u:object_r:mount_service:s0\nnetpolicy                                 u:object_r:netpolicy_service:s0\nnetstats                                  u:object_r:netstats_service:s0\nnetwork_management                        u:object_r:network_management_service:s0\nnetwork_score                             u:object_r:network_score_service:s0\nnfc                                       u:object_r:nfc_service:s0\nnotification                              u:object_r:notification_service:s0\npackage                                   u:object_r:package_service:s0\npermission                                u:object_r:permission_service:s0\npersistent_data_block                     u:object_r:persistent_data_block_service:s0\nphone_msim                                u:object_r:radio_service:s0\nphone1                                    u:object_r:radio_service:s0\nphone2                                    u:object_r:radio_service:s0\nphone                                     u:object_r:radio_service:s0\npower                                     u:object_r:power_service:s0\nprint                                     u:object_r:print_service:s0\nprocessinfo                               u:object_r:processinfo_service:s0\nprocstats                                 u:object_r:procstats_service:s0\nradio.phonesubinfo                        u:object_r:radio_service:s0\nradio.phone                               u:object_r:radio_service:s0\nradio.sms                                 u:object_r:radio_service:s0\nrestrictions                              u:object_r:restrictions_service:s0\nrttmanager                                u:object_r:rttmanager_service:s0\nsamplingprofiler                          u:object_r:samplingprofiler_service:s0\nscheduling_policy                         u:object_r:scheduling_policy_service:s0\nsearch                                    u:object_r:search_service:s0\nsensorservice                             u:object_r:sensorservice_service:s0\nserial                                    u:object_r:serial_service:s0\nservicediscovery                          u:object_r:servicediscovery_service:s0\nsimphonebook_msim                         u:object_r:radio_service:s0\nsimphonebook2                             u:object_r:radio_service:s0\nsimphonebook                              u:object_r:radio_service:s0\nsip                                       u:object_r:radio_service:s0\nstatusbar                                 u:object_r:statusbar_service:s0\nSurfaceFlinger                            u:object_r:surfaceflinger_service:s0\ntask                                      u:object_r:task_service:s0\ntelecom                                   u:object_r:telecom_service:s0\ntelephony.registry                        u:object_r:registry_service:s0\ntextservices                              u:object_r:textservices_service:s0\ntrust                                     u:object_r:trust_service:s0\ntv_input                                  u:object_r:tv_input_service:s0\nuimode                                    u:object_r:uimode_service:s0\nupdatelock                                u:object_r:updatelock_service:s0\nusagestats                                u:object_r:usagestats_service:s0\nusb                                       u:object_r:usb_service:s0\nuser                                      u:object_r:user_service:s0\nvibrator                                  u:object_r:vibrator_service:s0\nvoiceinteraction                          u:object_r:voiceinteraction_service:s0\nwallpaper                                 u:object_r:wallpaper_service:s0\nwebviewupdate                             u:object_r:webviewupdate_service:s0\nwifip2p                                   u:object_r:wifip2p_service:s0\nwifiscanner                               u:object_r:wifiscanner_service:s0\nwifi                                      u:object_r:wifi_service:s0\nwindow                                    u:object_r:window_service:s0\n# add by aggresss\nvirtualposition                           u:object_r:virtualposition_service:s0\n*                                         u:object_r:default_android_service:s0\n"
  },
  {
    "path": "VirtualPosition/vp_Framework/sepolicy/system_server.te",
    "content": "#\n# System Server aka system_server spawned by zygote.\n# Most of the framework services run in this process.\n#\ntype system_server, domain, mlstrustedsubject;\n\n# Define a type for tmpfs-backed ashmem regions.\ntmpfs_domain(system_server)\n\n# Dalvik Compiler JIT Mapping.\nallow system_server self:process execmem;\nallow system_server ashmem_device:chr_file execute;\nallow system_server system_server_tmpfs:file execute;\n\n# For art.\nallow system_server dalvikcache_data_file:file execute;\nallow system_server dalvikcache_data_file:dir r_dir_perms;\n\n# /data/resource-cache\nallow system_server resourcecache_data_file:file r_file_perms;\nallow system_server resourcecache_data_file:dir r_dir_perms;\n\n# ptrace to processes in the same domain for debugging crashes.\nallow system_server self:process ptrace;\n\n# Child of the zygote.\nallow system_server zygote:fd use;\nallow system_server zygote:process sigchld;\nallow system_server zygote_tmpfs:file read;\n\n# May kill zygote on crashes.\nallow system_server zygote:process sigkill;\n\n# Read /system/bin/app_process.\nallow system_server zygote_exec:file r_file_perms;\n\n# Needed to close the zygote socket, which involves getopt / getattr\nallow system_server zygote:unix_stream_socket { getopt getattr };\n\n# system server gets network and bluetooth permissions.\nnet_domain(system_server)\nbluetooth_domain(system_server)\n\n# These are the capabilities assigned by the zygote to the\n# system server.\nallow system_server self:capability {\n    kill\n    net_admin\n    net_bind_service\n    net_broadcast\n    net_raw\n    sys_boot\n    sys_nice\n    sys_resource\n    sys_time\n    sys_tty_config\n};\n\nwakelock_use(system_server)\n\n# Triggered by /proc/pid accesses, not allowed.\ndontaudit system_server self:capability sys_ptrace;\n\n# Trigger module auto-load.\nallow system_server kernel:system module_request;\n\n# Use netlink uevent sockets.\nallow system_server self:netlink_kobject_uevent_socket create_socket_perms;\n\n# Use generic netlink sockets.\nallow system_server self:netlink_socket create_socket_perms;\n\n# Set and get routes directly via netlink.\nallow system_server self:netlink_route_socket nlmsg_write;\n\n# Kill apps.\nallow system_server appdomain:process { sigkill signal };\n\n# Set scheduling info for apps.\nallow system_server appdomain:process { getsched setsched };\nallow system_server mediaserver:process { getsched setsched };\n\n# Read /proc/pid data for all domains. This is used by ProcessCpuTracker\n# within system_server to keep track of memory and CPU usage for\n# all processes on the device.\nr_dir_file(system_server, domain)\n\n# Read/Write to /proc/net/xt_qtaguid/ctrl and and /dev/xt_qtaguid.\nallow system_server qtaguid_proc:file rw_file_perms;\nallow system_server qtaguid_device:chr_file rw_file_perms;\n\n# Read /proc/uid_cputime/show_uid_stat.\nallow system_server proc_uid_cputime_showstat:file r_file_perms;\n\n# Write /proc/uid_cputime/remove_uid_range.\nallow system_server proc_uid_cputime_removeuid:file { w_file_perms getattr };\n\n# Write to /proc/sysrq-trigger.\nallow system_server proc_sysrq:file rw_file_perms;\n\n# Read /sys/kernel/debug/wakeup_sources.\nallow system_server debugfs:file r_file_perms;\n\n# The DhcpClient and WifiWatchdog use packet_sockets\nallow system_server self:packet_socket create_socket_perms;\n\n# NetworkDiagnostics requires explicit bind() calls to ping sockets. These aren't actually the same\n# as raw sockets, but the kernel doesn't yet distinguish between the two.\nallow system_server node:rawip_socket node_bind;\n\n# 3rd party VPN clients require a tun_socket to be created\nallow system_server self:tun_socket create_socket_perms;\n\n# Notify init of death.\nallow system_server init:process sigchld;\n\n# Talk to init and various daemons via sockets.\nunix_socket_connect(system_server, installd, installd)\nunix_socket_connect(system_server, lmkd, lmkd)\nunix_socket_connect(system_server, mtpd, mtp)\nunix_socket_connect(system_server, netd, netd)\nunix_socket_connect(system_server, vold, vold)\nunix_socket_connect(system_server, zygote, zygote)\nunix_socket_connect(system_server, gps, gpsd)\nunix_socket_connect(system_server, racoon, racoon)\nunix_socket_send(system_server, wpa, wpa)\n\n# Communicate over a socket created by surfaceflinger.\nallow system_server surfaceflinger:unix_stream_socket { read write setopt };\n\n# Perform Binder IPC.\nbinder_use(system_server)\nbinder_call(system_server, binderservicedomain)\nbinder_call(system_server, gatekeeperd)\nbinder_call(system_server, fingerprintd)\nbinder_call(system_server, appdomain)\nbinder_call(system_server, bootanim)\nbinder_call(system_server, dumpstate)\nbinder_service(system_server)\n\n# Ask debuggerd to dump backtraces for native stacks of interest.\nallow system_server { mediaserver sdcardd surfaceflinger inputflinger }:debuggerd dump_backtrace;\n\n# Read /proc/pid files for dumping stack traces of native processes.\nr_dir_file(system_server, mediaserver)\nr_dir_file(system_server, sdcardd)\nr_dir_file(system_server, surfaceflinger)\nr_dir_file(system_server, inputflinger)\n\n# Use sockets received over binder from various services.\nallow system_server mediaserver:tcp_socket rw_socket_perms;\nallow system_server mediaserver:udp_socket rw_socket_perms;\n\n# Check SELinux permissions.\nselinux_check_access(system_server)\n\n# XXX Label sysfs files with a specific type?\nallow system_server sysfs:file rw_file_perms;\nallow system_server sysfs_nfc_power_writable:file rw_file_perms;\nallow system_server sysfs_devices_system_cpu:file w_file_perms;\n\n# Access devices.\nallow system_server device:dir r_dir_perms;\nallow system_server mdns_socket:sock_file rw_file_perms;\nallow system_server alarm_device:chr_file rw_file_perms;\nallow system_server gpu_device:chr_file rw_file_perms;\nallow system_server iio_device:chr_file rw_file_perms;\nallow system_server input_device:dir r_dir_perms;\nallow system_server input_device:chr_file rw_file_perms;\nallow system_server radio_device:chr_file r_file_perms;\nallow system_server tty_device:chr_file rw_file_perms;\nallow system_server usbaccessory_device:chr_file rw_file_perms;\nallow system_server video_device:dir r_dir_perms;\nallow system_server video_device:chr_file rw_file_perms;\nallow system_server adbd_socket:sock_file rw_file_perms;\nallow system_server rtc_device:chr_file rw_file_perms;\nallow system_server audio_device:dir r_dir_perms;\n\n# write access needed for MIDI\nallow system_server audio_device:chr_file rw_file_perms;\n\n# tun device used for 3rd party vpn apps\nallow system_server tun_device:chr_file rw_file_perms;\n\n# Manage system data files.\nallow system_server system_data_file:dir create_dir_perms;\nallow system_server system_data_file:notdevfile_class_set create_file_perms;\nallow system_server keychain_data_file:dir create_dir_perms;\nallow system_server keychain_data_file:file create_file_perms;\n\n# Manage /data/app.\nallow system_server apk_data_file:dir create_dir_perms;\nallow system_server apk_data_file:file { create_file_perms link };\nallow system_server apk_tmp_file:dir create_dir_perms;\nallow system_server apk_tmp_file:file create_file_perms;\n\n# Manage /data/app-private.\nallow system_server apk_private_data_file:dir create_dir_perms;\nallow system_server apk_private_data_file:file create_file_perms;\nallow system_server apk_private_tmp_file:dir create_dir_perms;\nallow system_server apk_private_tmp_file:file create_file_perms;\n\n# Manage files within asec containers.\nallow system_server asec_apk_file:dir create_dir_perms;\nallow system_server asec_apk_file:file create_file_perms;\nallow system_server asec_public_file:file create_file_perms;\n\n# Manage /data/anr.\nallow system_server anr_data_file:dir create_dir_perms;\nallow system_server anr_data_file:file create_file_perms;\n\n# Manage /data/backup.\nallow system_server backup_data_file:dir create_dir_perms;\nallow system_server backup_data_file:file create_file_perms;\n\n# Read from /data/dalvik-cache/profiles\nallow system_server dalvikcache_profiles_data_file:dir rw_dir_perms;\nallow system_server dalvikcache_profiles_data_file:file create_file_perms;\n\n# Write to /data/system/heapdump\nallow system_server heapdump_data_file:dir rw_dir_perms;\nallow system_server heapdump_data_file:file create_file_perms;\n\n# Manage /data/misc/adb.\nallow system_server adb_keys_file:dir create_dir_perms;\nallow system_server adb_keys_file:file create_file_perms;\n\n# Manage /data/misc/sms.\n# TODO:  Split into a separate type?\nallow system_server radio_data_file:dir create_dir_perms;\nallow system_server radio_data_file:file create_file_perms;\n\n# Manage /data/misc/systemkeys.\nallow system_server systemkeys_data_file:dir create_dir_perms;\nallow system_server systemkeys_data_file:file create_file_perms;\n\n# Access /data/tombstones.\nallow system_server tombstone_data_file:dir r_dir_perms;\nallow system_server tombstone_data_file:file r_file_perms;\n\n# Manage /data/misc/vpn.\nallow system_server vpn_data_file:dir create_dir_perms;\nallow system_server vpn_data_file:file create_file_perms;\n\n# Manage /data/misc/wifi.\nallow system_server wifi_data_file:dir create_dir_perms;\nallow system_server wifi_data_file:file create_file_perms;\n\n# Manage /data/misc/zoneinfo.\nallow system_server zoneinfo_data_file:dir create_dir_perms;\nallow system_server zoneinfo_data_file:file create_file_perms;\n\n# Walk /data/data subdirectories.\n# Types extracted from seapp_contexts type= fields.\nallow system_server { system_app_data_file bluetooth_data_file nfc_data_file radio_data_file shell_data_file app_data_file }:dir { getattr read search };\n# Also permit for unlabeled /data/data subdirectories and\n# for unlabeled asec containers on upgrades from 4.2.\nallow system_server unlabeled:dir r_dir_perms;\n# Read pkg.apk file before it has been relabeled by vold.\nallow system_server unlabeled:file r_file_perms;\n\n# Populate com.android.providers.settings/databases/settings.db.\nallow system_server system_app_data_file:dir create_dir_perms;\nallow system_server system_app_data_file:file create_file_perms;\n\n# Receive and use open app data files passed over binder IPC.\n# Types extracted from seapp_contexts type= fields.\nallow system_server { system_app_data_file bluetooth_data_file nfc_data_file radio_data_file shell_data_file app_data_file }:file { getattr read write };\n\n# Receive and use open /data/media files passed over binder IPC.\nallow system_server media_rw_data_file:file { getattr read write };\n\n# Read /file_contexts and /data/security/file_contexts\nsecurity_access_policy(system_server)\n\n# Relabel apk files.\nallow system_server { apk_tmp_file apk_private_tmp_file }:{ dir file } { relabelfrom relabelto };\nallow system_server { apk_data_file apk_private_data_file }:{ dir file } { relabelfrom relabelto };\n\n# Relabel wallpaper.\nallow system_server system_data_file:file relabelfrom;\nallow system_server wallpaper_file:file relabelto;\nallow system_server wallpaper_file:file { rw_file_perms unlink };\n\n# Relabel /data/anr.\nallow system_server system_data_file:dir relabelfrom;\nallow system_server anr_data_file:dir relabelto;\n\n# Property Service write\nset_prop(system_server, system_prop)\nset_prop(system_server, dhcp_prop)\nset_prop(system_server, net_radio_prop)\nset_prop(system_server, system_radio_prop)\nset_prop(system_server, debug_prop)\nset_prop(system_server, powerctl_prop)\nset_prop(system_server, fingerprint_prop)\n\n# ctl interface\nallow system_server ctl_bootanim_prop:property_service set;\n\n# Use open file provided by bootanim.\nallow system_server bootanim:fd use;\n\nset_prop(system_server, ctl_default_prop)\nset_prop(system_server, ctl_dhcp_pan_prop)\nset_prop(system_server, ctl_bugreport_prop)\n\n# Create a socket for receiving info from wpa.\ntype_transition system_server wifi_data_file:sock_file system_wpa_socket;\ntype_transition system_server wpa_socket:sock_file system_wpa_socket;\nallow system_server wpa_socket:dir rw_dir_perms;\nallow system_server system_wpa_socket:sock_file create_file_perms;\n\n# Remove sockets created by wpa_supplicant\nallow system_server wpa_socket:sock_file unlink;\n\n# Create a socket for connections from debuggerd.\ntype_transition system_server system_data_file:sock_file system_ndebug_socket \"ndebugsocket\";\nallow system_server system_ndebug_socket:sock_file create_file_perms;\n\n# Manage cache files.\nallow system_server cache_file:dir { relabelfrom create_dir_perms };\nallow system_server cache_file:file { relabelfrom create_file_perms };\nallow system_server cache_file:fifo_file create_file_perms;\n\n# Run system programs, e.g. dexopt.\nallow system_server system_file:file x_file_perms;\n\n# LocationManager(e.g, GPS) needs to read and write\n# to uart driver and ctrl proc entry\nallow system_server gps_device:chr_file rw_file_perms;\nallow system_server gps_control:file rw_file_perms;\n\n# Allow system_server to use app-created sockets and pipes.\nallow system_server appdomain:{ tcp_socket udp_socket } { getattr getopt setopt read write shutdown };\nallow system_server appdomain:{ fifo_file unix_stream_socket } { getattr read write };\n\n# Allow abstract socket connection\nallow system_server rild:unix_stream_socket connectto;\n\n# BackupManagerService lets PMS create a data backup file\nallow system_server cache_backup_file:file create_file_perms;\n# Relabel /data/backup\nallow system_server backup_data_file:dir { relabelto relabelfrom };\n# Relabel /cache/.*\\.{data|restore}\nallow system_server cache_backup_file:file { relabelto relabelfrom };\n# LocalTransport creates and relabels /cache/backup\nallow system_server cache_backup_file:dir { relabelto relabelfrom create_dir_perms };\n\n# Allow system to talk to usb device\nallow system_server usb_device:chr_file rw_file_perms;\nallow system_server usb_device:dir r_dir_perms;\n\n# Allow system to talk to sensors\nallow system_server sensors_device:chr_file rw_file_perms;\n\n# Read from HW RNG (needed by EntropyMixer).\nallow system_server hw_random_device:chr_file r_file_perms;\n\n# Read and delete files under /dev/fscklogs.\nr_dir_file(system_server, fscklogs)\nallow system_server fscklogs:dir { write remove_name };\nallow system_server fscklogs:file unlink;\n\n# For SELinuxPolicyInstallReceiver\nselinux_manage_policy(system_server)\n\n# logd access, system_server inherit logd write socket\n# (urge is to deprecate this long term)\nallow system_server zygote:unix_dgram_socket write;\n\n# Read from log daemon.\nread_logd(system_server)\n\n# Be consistent with DAC permissions. Allow system_server to write to\n# /sys/module/lowmemorykiller/parameters/adj\n# /sys/module/lowmemorykiller/parameters/minfree\nallow system_server sysfs_lowmemorykiller:file { getattr w_file_perms };\n\n# Read /sys/fs/pstore/console-ramoops\n# Don't worry about overly broad permissions for now, as there's\n# only one file in /sys/fs/pstore\nallow system_server pstorefs:dir r_dir_perms;\nallow system_server pstorefs:file r_file_perms;\n\nallow system_server drmserver_service:service_manager find;\nallow system_server healthd_service:service_manager find;\nallow system_server keystore_service:service_manager find;\nallow system_server gatekeeper_service:service_manager find;\nallow system_server fingerprintd_service:service_manager find;\nallow system_server mediaserver_service:service_manager find;\nallow system_server nfc_service:service_manager find;\nallow system_server radio_service:service_manager find;\nallow system_server system_server_service:service_manager { add find };\nallow system_server surfaceflinger_service:service_manager find;\n\nallow system_server keystore:keystore_key {\n\tget_state\n\tget\n\tinsert\n\tdelete\n\texist\n\tlist\n\treset\n\tpassword\n\tlock\n\tunlock\n\tis_empty\n\tsign\n\tverify\n\tgrant\n\tduplicate\n\tclear_uid\n\tadd_auth\n\tuser_changed\n};\n\n# Allow system server to search and write to the persistent factory reset\n# protection partition. This block device does not get wiped in a factory reset.\nallow system_server block_device:dir search;\nallow system_server frp_block_device:blk_file rw_file_perms;\n\n# Clean up old cgroups\nallow system_server cgroup:dir { remove_name rmdir };\n\n# /oem access\nr_dir_file(system_server, oemfs)\n\n# Allow resolving per-user storage symlinks\nallow system_server { mnt_user_file storage_file }:dir { getattr search };\nallow system_server { mnt_user_file storage_file }:lnk_file { getattr read };\n\n# Allow statfs() on storage devices, which happens fast enough that\n# we shouldn't be killed during unsafe removal\nallow system_server sdcard_type:dir { getattr search };\n\n# Traverse into expanded storage\nallow system_server mnt_expand_file:dir r_dir_perms;\n\n# Allow system process to relabel the fingerprint directory after mkdir\n# and delete the directory and files when no longer needed\nallow system_server fingerprintd_data_file:dir { r_dir_perms remove_name rmdir relabelto write };\nallow system_server fingerprintd_data_file:file { getattr unlink };\n\n# For configuring sdcardfs\nallow system_server configfs:dir { create_dir_perms };\nallow system_server configfs:file { getattr open unlink write };\n\n###\n### Neverallow rules\n###\n### system_server should NEVER do any of this\n\n# Do not allow opening files from external storage as unsafe ejection\n# could cause the kernel to kill the system_server.\nneverallow system_server sdcard_type:dir { open read write };\nneverallow system_server sdcard_type:file rw_file_perms;\n\n# system server should never be opening zygote spawned app data\n# files directly. Rather, they should always be passed via a\n# file descriptor.\n# Types extracted from seapp_contexts type= fields, excluding\n# those types that system_server needs to open directly.\nneverallow system_server { bluetooth_data_file nfc_data_file shell_data_file app_data_file }:file open;\n\n# system_server should never be executing dex2oat. This is either\n# a bug (for example, bug 16317188), or represents an attempt by\n# system server to dynamically load a dex file, something we do not\n# want to allow.\nifelse(shipping_build, `true',\n  `neverallow system_server dex2oat_exec:file no_x_file_perms;'\n,\n)\n\n# The only block device system_server should be accessing is\n# the frp_block_device. This helps avoid a system_server to root\n# escalation by writing to raw block devices.\nneverallow system_server { dev_type -frp_block_device }:blk_file no_rw_file_perms;\n\n# add by aggresss\nallow system_server vp_device:chr_file rw_file_perms;\n"
  },
  {
    "path": "VirtualPosition/vp_HAL/vp/Android.mk",
    "content": "LOCAL_PATH := $(call my-dir)\n\tinclude $(CLEAR_VARS)\n\tLOCAL_MODULE_TAGS := optional\n\tLOCAL_PRELINK_MODULE := false\n\tLOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/hw\n\tLOCAL_SHARED_LIBRARIES := liblog\n\tLOCAL_SRC_FILES := vp.c\n\tLOCAL_MODULE := vp.default\n\tinclude $(BUILD_SHARED_LIBRARY)\n"
  },
  {
    "path": "VirtualPosition/vp_HAL/vp/vp.c",
    "content": "#define LOG_TAG \"VpStub\"  \n  \n#include <hardware/hardware.h>  \n#include <hardware/vp.h>  \n#include <fcntl.h>  \n#include <errno.h>  \n#include <cutils/log.h>  \n#include <cutils/atomic.h>  \n  \n#define DEVICE_NAME \"/dev/vp\"  \n#define MODULE_NAME \"Vp\"  \n#define MODULE_AUTHOR \"aggresss@163.com\"  \n  \n/*设备打开和关闭接口*/  \nstatic int vp_device_open(const struct hw_module_t* module, const char* name, struct hw_device_t** device);  \nstatic int vp_device_close(struct hw_device_t* device);  \n  \n/*设备访问接口*/  \nstatic int vp_set_val(struct vp_device_t* dev, VirtualPosition val);  \nstatic int vp_get_val(struct vp_device_t* dev, VirtualPosition* val);  \n  \n/*模块方法表*/  \nstatic struct hw_module_methods_t vp_module_methods = {  \n    open: vp_device_open  \n};  \n  \n/*模块实例变量*/  \nstruct vp_module_t HAL_MODULE_INFO_SYM = {  \n    common: {  \n        tag: HARDWARE_MODULE_TAG,  \n        version_major: 1,  \n        version_minor: 0,  \n        id: VP_HARDWARE_MODULE_ID,  \n        name: MODULE_NAME,  \n        author: MODULE_AUTHOR,  \n        methods: &vp_module_methods,  \n    }  \n};  \n\n\nstatic int vp_device_open(const struct hw_module_t* module, const char* name, struct hw_device_t** device) {  \n    struct vp_device_t* dev;dev = (struct vp_device_t*)malloc(sizeof(struct vp_device_t));  \n      \n    if(!dev) {  \n        ALOGE(\"Vp Stub: failed to alloc space\");  \n        return -EFAULT;  \n    }  \n  \n    memset(dev, 0, sizeof(struct vp_device_t));  \n    dev->common.tag = HARDWARE_DEVICE_TAG;  \n    dev->common.version = 0;  \n    dev->common.module = (hw_module_t*)module;  \n    dev->common.close = vp_device_close;  \n    dev->set_val = vp_set_val;dev->get_val = vp_get_val;  \n  \n    if((dev->fd = open(DEVICE_NAME, O_RDWR)) == -1) {  \n        ALOGE(\"Vp Stub: failed to open /dev/vp -- %s.\", strerror(errno));free(dev);  \n        return -EFAULT;  \n    }  \n  \n    *device = &(dev->common);  \n    ALOGI(\"Vp Stub: open /dev/vp successfully.\");  \n  \n    return 0;  \n}  \n\nstatic int vp_device_close(struct hw_device_t* device) {  \n    struct vp_device_t* vp_device = (struct vp_device_t*)device;  \n  \n    if(vp_device) {  \n        close(vp_device->fd);  \n        free(vp_device);  \n    }  \n      \n    return 0;  \n}  \n  \nstatic int vp_set_val(struct vp_device_t* dev, VirtualPosition val) {  \n    ALOGI(\"Vp Stub: set value %d to device.\", val);  \n  \n    write(dev->fd, &val, sizeof(val));  \n  \n    return 0;  \n}  \n  \nstatic int vp_get_val(struct vp_device_t* dev, VirtualPosition* val) {  \n    if(!val) {  \n        ALOGE(\"Vp Stub: error val pointer\");  \n        return -EFAULT;  \n    }  \n  \n    read(dev->fd, val, sizeof(*val));  \n  \n    ALOGI(\"Vp Stub: get value %d from device\", *val);  \n  \n    return 0;  \n}  \n"
  },
  {
    "path": "VirtualPosition/vp_HAL/vp.h",
    "content": " #ifndef ANDROID_VP_INTERFACE_H  \n#define ANDROID_VP_INTERFACE_H  \n#include <hardware/hardware.h>  \n__BEGIN_DECLS  \n  \n/*定义模块ID*/  \n#define VP_HARDWARE_MODULE_ID \"vp\"  \n\n//typedef enum{false, true} bool;\n\n/*define virtual position structrue*/\ntypedef struct {\n    int toggle;\n    double virtual_latitude;\n    double virtual_longitude;\n} VirtualPosition;\n\n\n\n/*硬件模块结构体*/  \nstruct vp_module_t {  \n    struct hw_module_t common;  \n};  \n  \n/*硬件接口结构体*/  \nstruct vp_device_t {  \n    struct hw_device_t common;  \n    int fd;  \n    int (*set_val)(struct vp_device_t* dev, VirtualPosition val);  \n    int (*get_val)(struct vp_device_t* dev, VirtualPosition* val);  \n};  \n  \n__END_DECLS  \n  \n#endif  \n"
  },
  {
    "path": "VirtualPosition/vp_JNI/Android.mk",
    "content": "# This file is included by the top level services directory to collect source\n# files\nLOCAL_REL_DIR := core/jni\n\nLOCAL_CFLAGS += -Wall -Werror -Wno-unused-parameter\n\nifneq ($(ENABLE_CPUSETS),)\nifneq ($(ENABLE_SCHED_BOOST),)\nLOCAL_CFLAGS += -DUSE_SCHED_BOOST\nendif\nendif\n\nLOCAL_SRC_FILES += \\\n    $(LOCAL_REL_DIR)/com_android_server_AlarmManagerService.cpp \\\n    $(LOCAL_REL_DIR)/com_android_server_am_BatteryStatsService.cpp \\\n    $(LOCAL_REL_DIR)/com_android_server_am_ActivityManagerService.cpp \\\n    $(LOCAL_REL_DIR)/com_android_server_AssetAtlasService.cpp \\\n    $(LOCAL_REL_DIR)/com_android_server_connectivity_Vpn.cpp \\\n    $(LOCAL_REL_DIR)/com_android_server_ConsumerIrService.cpp \\\n    $(LOCAL_REL_DIR)/com_android_server_hdmi_HdmiCecController.cpp \\\n    $(LOCAL_REL_DIR)/com_android_server_input_InputApplicationHandle.cpp \\\n    $(LOCAL_REL_DIR)/com_android_server_input_InputManagerService.cpp \\\n    $(LOCAL_REL_DIR)/com_android_server_input_InputWindowHandle.cpp \\\n    $(LOCAL_REL_DIR)/com_android_server_lights_LightsService.cpp \\\n    $(LOCAL_REL_DIR)/com_android_server_location_GpsLocationProvider.cpp \\\n    $(LOCAL_REL_DIR)/com_android_server_location_FlpHardwareProvider.cpp \\\n    $(LOCAL_REL_DIR)/com_android_server_power_PowerManagerService.cpp \\\n    $(LOCAL_REL_DIR)/com_android_server_SerialService.cpp \\\n    $(LOCAL_REL_DIR)/com_android_server_SystemServer.cpp \\\n    $(LOCAL_REL_DIR)/com_android_server_tv_TvInputHal.cpp \\\n    $(LOCAL_REL_DIR)/com_android_server_UsbDeviceManager.cpp \\\n    $(LOCAL_REL_DIR)/com_android_server_UsbMidiDevice.cpp \\\n    $(LOCAL_REL_DIR)/com_android_server_UsbHostManager.cpp \\\n    $(LOCAL_REL_DIR)/com_android_server_VibratorService.cpp \\\n    $(LOCAL_REL_DIR)/com_android_server_PersistentDataBlockService.cpp \\\n    $(LOCAL_REL_DIR)/com_android_server_VirtualPositionService.cpp \\\n    $(LOCAL_REL_DIR)/onload.cpp\n\nLOCAL_C_INCLUDES += \\\n    $(JNI_H_INCLUDE) \\\n    frameworks/base/services \\\n    frameworks/base/libs \\\n    frameworks/base/libs/hwui \\\n    frameworks/base/core/jni \\\n    frameworks/native/services \\\n    libcore/include \\\n    libcore/include/libsuspend \\\n    system/security/keystore/include \\\n    $(call include-path-for, libhardware)/hardware \\\n    $(call include-path-for, libhardware_legacy)/hardware_legacy \\\n\nLOCAL_SHARED_LIBRARIES += \\\n    libandroid_runtime \\\n    libandroidfw \\\n    libbinder \\\n    libcutils \\\n    liblog \\\n    libhardware \\\n    libhardware_legacy \\\n    libkeystore_binder \\\n    libnativehelper \\\n    libutils \\\n    libui \\\n    libinput \\\n    libinputflinger \\\n    libinputservice \\\n    libsensorservice \\\n    libskia \\\n    libgui \\\n    libusbhost \\\n    libsuspend \\\n    libEGL \\\n    libGLESv2 \\\n    libnetutils \\\n\nifeq ($(BOARD_USES_QC_TIME_SERVICES),true)\nLOCAL_CFLAGS += -DHAVE_QC_TIME_SERVICES=1\nLOCAL_SHARED_LIBRARIES += libtime_genoff\n$(shell mkdir -p $(OUT)/obj/SHARED_LIBRARIES/libtime_genoff_intermediates/)\n$(shell touch $(OUT)/obj/SHARED_LIBRARIES/libtime_genoff_intermediates/export_includes)\nendif\n\n"
  },
  {
    "path": "VirtualPosition/vp_JNI/com_android_server_VirtualPositionService.cpp",
    "content": "#define LOG_TAG \"VirtualPositionService\"  \n#include \"jni.h\"  \n#include \"JNIHelp.h\"  \n#include \"android_runtime/AndroidRuntime.h\"  \n#include <utils/misc.h>  \n#include <utils/Log.h>  \n#include <hardware/hardware.h>  \n#include <hardware/vp.h>  \n#include <stdio.h>  \n\nnamespace android  \n{  \n    \n        VirtualPosition virtual_position = {1, 0.0, 0.0};\n    /*在硬件抽象层中定义的硬件访问结构体，参考<hardware/vp.h>*/  \n        struct vp_device_t* vp_device = NULL;  \n    /*通过硬件抽象层定义的硬件访问接口设置硬件寄存器val的值*/  \n        static void vp_setVal() {  \n        ALOGI(\"VirtualPosition JNI: set value to device.\");  \n        if(!vp_device) {  \n            ALOGI(\"VirtualPosition JNI: device is not open.\");  \n            return;  \n        }  \n          \n        vp_device->set_val(vp_device, virtual_position);  \n    }  \n        /*通过硬件抽象层定义的硬件访问接口读取硬件寄存器val的值*/  \n    static void vp_getVal() {  \n        if(!vp_device) {  \n            ALOGI(\"VirtualPosition JNI: device is not open.\");  \n        }  \n        vp_device->get_val(vp_device, &virtual_position);  \n          \n        ALOGI(\"VirtualPosition JNI: get value from device.\");  \n    }  \n        /*通过硬件抽象层定义的硬件模块打开接口打开硬件设备*/  \n    static inline int vp_device_open(const hw_module_t* module, struct vp_device_t** device) {  \n        return module->methods->open(module, VP_HARDWARE_MODULE_ID, (struct hw_device_t**)device);  \n    }  \n        /*通过硬件模块ID来加载指定的硬件抽象层模块并打开硬件*/  \n    static jboolean vp_init(JNIEnv* env, jclass clazz) {  \n        vp_module_t* module;  \n          \n        ALOGI(\"VirtualPosition JNI: initializing......\");  \n        if(hw_get_module(VP_HARDWARE_MODULE_ID, (const struct hw_module_t**)&module) == 0) {  \n            ALOGI(\"VirtualPosition JNI: vp Stub found.\");  \n            if(vp_device_open(&(module->common), &vp_device) == 0) {  \n                ALOGI(\"VirtualPosition JNI: vp device is open.\");  \n                return 0;  \n            }  \n            ALOGE(\"VirtualPosition JNI: failed to open vp device.\");  \n            return -1;  \n        }  \n        ALOGE(\"VirtualPosition JNI: failed to get vp stub module.\");  \n        return -1;        \n    }  \n    \n    static void android_server_VirtualPositionService_set_virtual_toggle(JNIEnv* env, jclass clazz, jint tog)\n    {\n        virtual_position.toggle = tog;\n        vp_setVal();\n    }\n\n    static jint android_server_VirtualPositionService_get_virtual_toggle(JNIEnv* env, jclass clazz)\n    {\n        vp_getVal();\n        return virtual_position.toggle;\n    }\n\n    static void android_server_VirtualPositionService_set_virtual_latitude(JNIEnv* env, jclass clazz, jdouble vlat)\n    {\n        virtual_position.virtual_latitude = vlat;\n        vp_setVal();\n    }\n\n    static jdouble android_server_VirtualPositionService_get_virtual_latitude(JNIEnv* env, jclass clazz)\n    {\n        vp_getVal();\n        return virtual_position.virtual_latitude;\n    }\n\n    static void android_server_VirtualPositionService_set_virtual_longitude(JNIEnv* env, jclass clazz, jdouble vlon)\n    {\n        virtual_position.virtual_longitude = vlon;\n        vp_setVal();\n    }\n\n    static jdouble android_server_VirtualPositionService_get_virtual_longitude(JNIEnv* env, jclass clazz)\n    {\n        vp_getVal();\n        return virtual_position.virtual_longitude;\n    }\n\n\n\n    /*JNI方法表*/  \n    static const JNINativeMethod method_table[] = {  \n        {\"init_native\",\n            \"()Z\", \n            (void*)vp_init},  \n        {\"native_set_virtual_toggle\",\n            \"(I)V\",\n            (void*)android_server_VirtualPositionService_set_virtual_toggle},\n        {\"native_get_virtual_toggle\",\n            \"()I\",\n            (void*)android_server_VirtualPositionService_get_virtual_toggle},\n        {\"native_set_virtual_latitude\",\n            \"(D)V\",\n            (void*)android_server_VirtualPositionService_set_virtual_latitude},\n        {\"native_get_virtual_latitude\",\n            \"()D\",\n            (void*)android_server_VirtualPositionService_get_virtual_latitude},\n        {\"native_set_virtual_longitude\",\n            \"(D)V\",\n            (void*)android_server_VirtualPositionService_set_virtual_longitude},\n        {\"native_get_virtual_longitude\",\n            \"()D\",\n            (void*)android_server_VirtualPositionService_get_virtual_longitude},\n\n    };  \n        /*注册JNI方法*/  \n    int register_android_server_VirtualPositionService(JNIEnv *env) {  \n            return jniRegisterNativeMethods(env, \"com/android/server/VirtualPositionService\", method_table, NELEM(method_table));  \n    }  \n};  \n"
  },
  {
    "path": "VirtualPosition/vp_JNI/onload.cpp",
    "content": "/*\n * Copyright (C) 2009 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"JNIHelp.h\"\n#include \"jni.h\"\n#include \"utils/Log.h\"\n#include \"utils/misc.h\"\n\nnamespace android {\nint register_android_server_ActivityManagerService(JNIEnv* env);\nint register_android_server_AlarmManagerService(JNIEnv* env);\nint register_android_server_AssetAtlasService(JNIEnv* env);\nint register_android_server_BatteryStatsService(JNIEnv* env);\nint register_android_server_ConsumerIrService(JNIEnv *env);\nint register_android_server_InputApplicationHandle(JNIEnv* env);\nint register_android_server_InputWindowHandle(JNIEnv* env);\nint register_android_server_InputManager(JNIEnv* env);\nint register_android_server_LightsService(JNIEnv* env);\nint register_android_server_PowerManagerService(JNIEnv* env);\nint register_android_server_SerialService(JNIEnv* env);\nint register_android_server_SystemServer(JNIEnv* env);\nint register_android_server_UsbDeviceManager(JNIEnv* env);\nint register_android_server_UsbMidiDevice(JNIEnv* env);\nint register_android_server_UsbHostManager(JNIEnv* env);\nint register_android_server_VibratorService(JNIEnv* env);\nint register_android_server_location_GpsLocationProvider(JNIEnv* env);\nint register_android_server_location_FlpHardwareProvider(JNIEnv* env);\nint register_android_server_connectivity_Vpn(JNIEnv* env);\nint register_android_server_hdmi_HdmiCecController(JNIEnv* env);\nint register_android_server_tv_TvInputHal(JNIEnv* env);\nint register_android_server_PersistentDataBlockService(JNIEnv* env);\nint register_android_server_Watchdog(JNIEnv* env);\nint register_android_server_VirtualPositionService(JNIEnv* env);\n};\n\nusing namespace android;\n\nextern \"C\" jint JNI_OnLoad(JavaVM* vm, void* /* reserved */)\n{\n    JNIEnv* env = NULL;\n    jint result = -1;\n\n    if (vm->GetEnv((void**) &env, JNI_VERSION_1_4) != JNI_OK) {\n        ALOGE(\"GetEnv failed!\");\n        return result;\n    }\n    ALOG_ASSERT(env, \"Could not retrieve the env!\");\n\n    register_android_server_ActivityManagerService(env);\n    register_android_server_PowerManagerService(env);\n    register_android_server_SerialService(env);\n    register_android_server_InputApplicationHandle(env);\n    register_android_server_InputWindowHandle(env);\n    register_android_server_InputManager(env);\n    register_android_server_LightsService(env);\n    register_android_server_AlarmManagerService(env);\n    register_android_server_UsbDeviceManager(env);\n    register_android_server_UsbMidiDevice(env);\n    register_android_server_UsbHostManager(env);\n    register_android_server_VibratorService(env);\n    register_android_server_SystemServer(env);\n    register_android_server_location_GpsLocationProvider(env);\n    register_android_server_location_FlpHardwareProvider(env);\n    register_android_server_connectivity_Vpn(env);\n    register_android_server_AssetAtlasService(env);\n    register_android_server_ConsumerIrService(env);\n    register_android_server_BatteryStatsService(env);\n    register_android_server_hdmi_HdmiCecController(env);\n    register_android_server_tv_TvInputHal(env);\n    register_android_server_PersistentDataBlockService(env);\n    register_android_server_Watchdog(env);\n    register_android_server_VirtualPositionService(env);\n\n    return JNI_VERSION_1_4;\n}\n"
  },
  {
    "path": "VirtualPosition/vp_KernelDriver/cyanogen_cancro_defconfig",
    "content": "# CONFIG_ARM_PATCH_PHYS_VIRT is not set\nCONFIG_EXPERIMENTAL=y\nCONFIG_LOCALVERSION=\"-cyanogenmod\"\nCONFIG_KERNEL_LZMA=y\nCONFIG_SYSVIPC=y\nCONFIG_AUDIT=y\nCONFIG_RCU_FAST_NO_HZ=y\nCONFIG_LOG_BUF_SHIFT=21\nCONFIG_CGROUPS=y\nCONFIG_CGROUP_DEBUG=y\nCONFIG_CGROUP_FREEZER=y\nCONFIG_CGROUP_CPUACCT=y\nCONFIG_RESOURCE_COUNTERS=y\nCONFIG_CGROUP_SCHED=y\nCONFIG_RT_GROUP_SCHED=y\nCONFIG_NAMESPACES=y\n# CONFIG_UTS_NS is not set\n# CONFIG_IPC_NS is not set\n# CONFIG_USER_NS is not set\n# CONFIG_PID_NS is not set\nCONFIG_RELAY=y\nCONFIG_BLK_DEV_INITRD=y\nCONFIG_RD_BZIP2=y\nCONFIG_RD_LZMA=y\nCONFIG_CC_OPTIMIZE_FOR_SIZE=y\nCONFIG_PANIC_TIMEOUT=5\nCONFIG_KALLSYMS_ALL=y\nCONFIG_EMBEDDED=y\n# CONFIG_SLUB_DEBUG is not set\nCONFIG_PROFILING=y\nCONFIG_OPROFILE=y\nCONFIG_MODULES=y\nCONFIG_MODULE_UNLOAD=y\nCONFIG_MODULE_FORCE_UNLOAD=y\nCONFIG_MODVERSIONS=y\nCONFIG_PARTITION_ADVANCED=y\nCONFIG_EFI_PARTITION=y\n# CONFIG_IOSCHED_TEST is not set\nCONFIG_IOSCHED_BFQ=y\nCONFIG_CGROUP_BFQIO=y\nCONFIG_DEFAULT_BFQ=y\nCONFIG_ARCH_MSM=y\nCONFIG_ARCH_MSM8974=y\nCONFIG_ARCH_MSMSAMARIUM=y\nCONFIG_MSM_KRAIT_TBB_ABORT_HANDLER=y\n# CONFIG_MSM_STACKED_MEMORY is not set\nCONFIG_CPU_HAS_L2_PMU=y\n# CONFIG_MSM_FIQ_SUPPORT is not set\n# CONFIG_MSM_PROC_COMM is not set\nCONFIG_MSM_SMD=y\nCONFIG_MSM_SMD_PKG4=y\nCONFIG_MSM_BAM_DMUX=y\nCONFIG_MSM_SMP2P=y\nCONFIG_MSM_SMP2P_TEST=y\n# CONFIG_MSM_RESET_MODEM is not set\nCONFIG_MSM_IPC_LOGGING=y\nCONFIG_MSM_IPC_ROUTER=y\nCONFIG_MSM_IPC_ROUTER_SMD_XPRT=y\nCONFIG_MSM_IPC_ROUTER_SECURITY=y\nCONFIG_MSM_QMI_INTERFACE=y\n# CONFIG_MSM_DMA_TEST is not set\nCONFIG_MSM_SUBSYSTEM_RESTART=y\nCONFIG_MSM_SYSMON_COMM=y\nCONFIG_MSM_PIL_LPASS_QDSP6V5=y\nCONFIG_MSM_PIL_MSS_QDSP6V5=y\nCONFIG_MSM_PIL_VENUS=y\nCONFIG_MSM_PIL_PRONTO=y\nCONFIG_MSM_TZ_LOG=y\nCONFIG_MSM_RPM_RBCPR_STATS_V2_LOG=y\nCONFIG_MSM_DIRECT_SCLK_ACCESS=y\nCONFIG_MSM_EVENT_TIMER=y\nCONFIG_MSM_BUS_SCALING=y\nCONFIG_MSM_WATCHDOG_V2=y\nCONFIG_MSM_MEMORY_DUMP=y\n# CONFIG_MSM_DLOAD_MODE is not set\nCONFIG_MSM_JTAG=y\nCONFIG_MSM_ADSP_LOADER=y\nCONFIG_MSM_OCMEM=y\nCONFIG_MSM_OCMEM_LOCAL_POWER_CTRL=y\nCONFIG_MSM_OCMEM_DEBUG=y\nCONFIG_SENSORS_ADSP=y\nCONFIG_MSM_CACHE_ERP=y\nCONFIG_MSM_L1_ERR_PANIC=y\nCONFIG_MSM_L1_ERR_LOG=y\nCONFIG_MSM_L2_ERP_PRINT_ACCESS_ERRORS=y\nCONFIG_MSM_L2_ERP_PORT_PANIC=y\nCONFIG_MSM_L2_ERP_2BIT_PANIC=y\nCONFIG_MSM_CACHE_DUMP=y\nCONFIG_MSM_CACHE_DUMP_ON_PANIC=y\nCONFIG_MSM_ENABLE_WDOG_DEBUG_CONTROL=y\nCONFIG_MSM_BOOT_STATS=y\nCONFIG_MSM_XPU_ERR_FATAL=y\nCONFIG_HAS_MACH_MEMUTILS=y\nCONFIG_STRICT_MEMORY_RWX=y\nCONFIG_NO_HZ=y\nCONFIG_HIGH_RES_TIMERS=y\nCONFIG_SMP=y\n# CONFIG_SMP_ON_UP is not set\nCONFIG_SCHED_MC=y\nCONFIG_ARM_ARCH_TIMER=y\nCONFIG_PREEMPT=y\nCONFIG_AEABI=y\nCONFIG_HIGHMEM=y\nCONFIG_COMPACTION=y\nCONFIG_KSM=y\nCONFIG_ENABLE_VMALLOC_SAVING=y\nCONFIG_CC_STACKPROTECTOR=y\nCONFIG_CP_ACCESS=y\nCONFIG_USE_OF=y\nCONFIG_BUILD_ARM_APPENDED_DTB_IMAGE=y\nCONFIG_CPU_FREQ=y\nCONFIG_CPU_FREQ_GOV_ONDEMAND=y\nCONFIG_CPU_FREQ_GOV_INTERACTIVE=y\nCONFIG_CPU_FREQ_GOV_CONSERVATIVE=y\nCONFIG_CPU_BOOST=y\nCONFIG_CPU_IDLE=y\nCONFIG_VFP=y\nCONFIG_NEON=y\nCONFIG_KERNEL_MODE_NEON=y\n# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set\nCONFIG_PM_AUTOSLEEP=y\nCONFIG_PM_WAKELOCKS=y\nCONFIG_PM_WAKELOCKS_LIMIT=0\n# CONFIG_PM_WAKELOCKS_GC is not set\nCONFIG_PM_RUNTIME=y\nCONFIG_PM_DEBUG=y\nCONFIG_SUSPEND_TIME=y\nCONFIG_NET=y\nCONFIG_PACKET=y\nCONFIG_UNIX=y\nCONFIG_XFRM_USER=y\nCONFIG_NET_KEY=y\nCONFIG_INET=y\nCONFIG_IP_ADVANCED_ROUTER=y\nCONFIG_IP_MULTIPLE_TABLES=y\nCONFIG_IP_ROUTE_VERBOSE=y\nCONFIG_IP_PNP=y\nCONFIG_IP_PNP_DHCP=y\nCONFIG_INET_AH=y\nCONFIG_INET_ESP=y\n# CONFIG_INET_XFRM_MODE_BEET is not set\n# CONFIG_INET_LRO is not set\nCONFIG_IPV6=y\nCONFIG_IPV6_PRIVACY=y\nCONFIG_IPV6_ROUTER_PREF=y\nCONFIG_IPV6_ROUTE_INFO=y\nCONFIG_IPV6_OPTIMISTIC_DAD=y\nCONFIG_INET6_AH=y\nCONFIG_INET6_ESP=y\nCONFIG_INET6_IPCOMP=y\nCONFIG_IPV6_MIP6=y\nCONFIG_IPV6_MULTIPLE_TABLES=y\nCONFIG_IPV6_SUBTREES=y\nCONFIG_NETFILTER=y\nCONFIG_NF_CONNTRACK=y\nCONFIG_NF_CONNTRACK_SECMARK=y\nCONFIG_NF_CONNTRACK_EVENTS=y\nCONFIG_NF_CT_PROTO_DCCP=y\nCONFIG_NF_CT_PROTO_SCTP=y\nCONFIG_NF_CT_PROTO_UDPLITE=y\nCONFIG_NF_CONNTRACK_AMANDA=y\nCONFIG_NF_CONNTRACK_FTP=y\nCONFIG_NF_CONNTRACK_H323=y\nCONFIG_NF_CONNTRACK_IRC=y\nCONFIG_NF_CONNTRACK_NETBIOS_NS=y\nCONFIG_NF_CONNTRACK_PPTP=y\nCONFIG_NF_CONNTRACK_SANE=y\nCONFIG_NF_CONNTRACK_TFTP=y\nCONFIG_NF_CT_NETLINK=y\nCONFIG_NETFILTER_TPROXY=y\nCONFIG_NETFILTER_XT_TARGET_CLASSIFY=y\nCONFIG_NETFILTER_XT_TARGET_CONNMARK=y\nCONFIG_NETFILTER_XT_TARGET_CONNSECMARK=y\nCONFIG_NETFILTER_XT_TARGET_IDLETIMER=y\nCONFIG_NETFILTER_XT_TARGET_LOG=y\nCONFIG_NETFILTER_XT_TARGET_MARK=y\nCONFIG_NETFILTER_XT_TARGET_NFLOG=y\nCONFIG_NETFILTER_XT_TARGET_NFQUEUE=y\nCONFIG_NETFILTER_XT_TARGET_NOTRACK=y\nCONFIG_NETFILTER_XT_TARGET_TEE=y\nCONFIG_NETFILTER_XT_TARGET_TPROXY=y\nCONFIG_NETFILTER_XT_TARGET_TRACE=y\nCONFIG_NETFILTER_XT_TARGET_SECMARK=y\nCONFIG_NETFILTER_XT_TARGET_TCPMSS=y\nCONFIG_NETFILTER_XT_MATCH_COMMENT=y\nCONFIG_NETFILTER_XT_MATCH_CONNLIMIT=y\nCONFIG_NETFILTER_XT_MATCH_CONNMARK=y\nCONFIG_NETFILTER_XT_MATCH_CONNTRACK=y\nCONFIG_NETFILTER_XT_MATCH_DSCP=y\nCONFIG_NETFILTER_XT_MATCH_HASHLIMIT=y\nCONFIG_NETFILTER_XT_MATCH_HELPER=y\nCONFIG_NETFILTER_XT_MATCH_IPRANGE=y\nCONFIG_NETFILTER_XT_MATCH_LENGTH=y\nCONFIG_NETFILTER_XT_MATCH_LIMIT=y\nCONFIG_NETFILTER_XT_MATCH_MAC=y\nCONFIG_NETFILTER_XT_MATCH_MARK=y\nCONFIG_NETFILTER_XT_MATCH_MULTIPORT=y\nCONFIG_NETFILTER_XT_MATCH_POLICY=y\nCONFIG_NETFILTER_XT_MATCH_PKTTYPE=y\nCONFIG_NETFILTER_XT_MATCH_QTAGUID=y\nCONFIG_NETFILTER_XT_MATCH_QUOTA=y\nCONFIG_NETFILTER_XT_MATCH_QUOTA2=y\nCONFIG_NETFILTER_XT_MATCH_QUOTA2_LOG=y\nCONFIG_NETFILTER_XT_MATCH_SOCKET=y\nCONFIG_NETFILTER_XT_MATCH_STATE=y\nCONFIG_NETFILTER_XT_MATCH_STATISTIC=y\nCONFIG_NETFILTER_XT_MATCH_STRING=y\nCONFIG_NETFILTER_XT_MATCH_TIME=y\nCONFIG_NETFILTER_XT_MATCH_U32=y\nCONFIG_NF_CONNTRACK_IPV4=y\nCONFIG_IP_NF_IPTABLES=y\nCONFIG_IP_NF_MATCH_AH=y\nCONFIG_IP_NF_MATCH_ECN=y\nCONFIG_IP_NF_MATCH_TTL=y\nCONFIG_IP_NF_FILTER=y\nCONFIG_IP_NF_TARGET_REJECT=y\nCONFIG_IP_NF_TARGET_REJECT_SKERR=y\nCONFIG_NF_NAT=y\nCONFIG_IP_NF_TARGET_MASQUERADE=y\nCONFIG_IP_NF_TARGET_NETMAP=y\nCONFIG_IP_NF_TARGET_REDIRECT=y\nCONFIG_IP_NF_MANGLE=y\nCONFIG_IP_NF_RAW=y\nCONFIG_IP_NF_SECURITY=y\nCONFIG_IP_NF_ARPTABLES=y\nCONFIG_IP_NF_ARPFILTER=y\nCONFIG_IP_NF_ARP_MANGLE=y\nCONFIG_NF_CONNTRACK_IPV6=y\nCONFIG_IP6_NF_IPTABLES=y\nCONFIG_IP6_NF_FILTER=y\nCONFIG_IP6_NF_TARGET_REJECT=y\nCONFIG_IP6_NF_TARGET_REJECT_SKERR=y\nCONFIG_IP6_NF_MANGLE=y\nCONFIG_IP6_NF_RAW=y\nCONFIG_BRIDGE_NF_EBTABLES=y\nCONFIG_BRIDGE_EBT_BROUTE=y\nCONFIG_BRIDGE=y\nCONFIG_NET_SCHED=y\nCONFIG_NET_SCH_HTB=y\nCONFIG_NET_SCH_PRIO=y\nCONFIG_NET_CLS_FW=y\nCONFIG_NET_CLS_U32=y\nCONFIG_CLS_U32_MARK=y\nCONFIG_NET_CLS_FLOW=y\nCONFIG_NET_EMATCH=y\nCONFIG_NET_EMATCH_CMP=y\nCONFIG_NET_EMATCH_NBYTE=y\nCONFIG_NET_EMATCH_U32=y\nCONFIG_NET_EMATCH_META=y\nCONFIG_NET_EMATCH_TEXT=y\nCONFIG_NET_CLS_ACT=y\nCONFIG_BT=y\nCONFIG_BT_RFCOMM=y\nCONFIG_BT_RFCOMM_TTY=y\nCONFIG_BT_BNEP=y\nCONFIG_BT_BNEP_MC_FILTER=y\nCONFIG_BT_BNEP_PROTO_FILTER=y\nCONFIG_BT_HCISMD=y\nCONFIG_BT_HCIUART=y\nCONFIG_BT_HCIUART_ATH3K=y\nCONFIG_MSM_BT_POWER=y\nCONFIG_CFG80211=y\nCONFIG_NL80211_TESTMODE=y\nCONFIG_CFG80211_INTERNAL_REGDB=y\nCONFIG_RFKILL=y\nCONFIG_NFC=y\nCONFIG_NFC_LLCP=y\nCONFIG_BCM2079X_NFC=y\nCONFIG_GENLOCK=y\nCONFIG_GENLOCK_MISCDEVICE=y\nCONFIG_CMA=y\nCONFIG_BLK_DEV_LOOP=y\nCONFIG_BLK_DEV_RAM=y\nCONFIG_BLK_DEV_RAM_SIZE=8192\nCONFIG_UID_STAT=y\nCONFIG_QSEECOM=y\nCONFIG_QPNP_MISC=y\nCONFIG_USB_HSIC_SMSC_HUB=y\nCONFIG_STM32_FW_UPDATER=y\nCONFIG_UID_CPUTIME=y\nCONFIG_SCSI=y\nCONFIG_SCSI_TGT=y\nCONFIG_BLK_DEV_SD=y\nCONFIG_CHR_DEV_SG=y\nCONFIG_CHR_DEV_SCH=y\nCONFIG_SCSI_MULTI_LUN=y\nCONFIG_SCSI_CONSTANTS=y\nCONFIG_SCSI_LOGGING=y\nCONFIG_SCSI_SCAN_ASYNC=y\nCONFIG_MD=y\nCONFIG_BLK_DEV_DM=y\nCONFIG_DM_CRYPT=y\nCONFIG_DM_REQ_CRYPT=y\nCONFIG_DM_UEVENT=y\nCONFIG_DM_VERITY=y\nCONFIG_NETDEVICES=y\nCONFIG_DUMMY=y\nCONFIG_TUN=y\n# CONFIG_MSM_RMNET is not set\nCONFIG_MSM_RMNET_BAM=y\nCONFIG_PPP=y\nCONFIG_PPP_BSDCOMP=y\nCONFIG_PPP_DEFLATE=y\nCONFIG_PPP_FILTER=y\nCONFIG_PPP_MPPE=y\nCONFIG_PPPOLAC=y\nCONFIG_PPPOPNS=y\nCONFIG_PPP_ASYNC=y\nCONFIG_PPP_SYNC_TTY=y\nCONFIG_SLIP=y\nCONFIG_SLIP_COMPRESSED=y\nCONFIG_SLIP_MODE_SLIP6=y\nCONFIG_USB_USBNET=y\nCONFIG_WCNSS_CORE=y\nCONFIG_WCNSS_CORE_PRONTO=y\nCONFIG_WCNSS_MEM_PRE_ALLOC=y\nCONFIG_WCNSS_REGISTER_DUMP_ON_BITE=y\nCONFIG_INPUT_EVDEV=y\nCONFIG_INPUT_KEYRESET=y\n# CONFIG_KEYBOARD_ATKBD is not set\nCONFIG_KEYBOARD_GPIO=y\n# CONFIG_INPUT_MOUSE is not set\nCONFIG_INPUT_JOYSTICK=y\nCONFIG_JOYSTICK_XPAD=y\nCONFIG_JOYSTICK_XPAD_FF=y\nCONFIG_JOYSTICK_XPAD_LEDS=y\nCONFIG_INPUT_TABLET=y\nCONFIG_TABLET_USB_ACECAD=y\nCONFIG_TABLET_USB_AIPTEK=y\nCONFIG_TABLET_USB_GTCO=y\nCONFIG_TABLET_USB_HANWANG=y\nCONFIG_TABLET_USB_KBTAB=y\nCONFIG_TABLET_USB_WACOM=y\nCONFIG_INPUT_TOUCHSCREEN=y\nCONFIG_TOUCHSCREEN_SYNAPTICS_DSX_I2C=y\nCONFIG_TOUCHSCREEN_SYNAPTICS_DSX_I2C_INCELL=y\nCONFIG_TOUCHSCREEN_SYNAPTICS_DSX_CORE=y\nCONFIG_TOUCHSCREEN_SYNAPTICS_DSX_CORE_INCELL=y\nCONFIG_TOUCHSCREEN_SYNAPTICS_DSX_RMI_DEV=y\nCONFIG_TOUCHSCREEN_SYNAPTICS_DSX_RMI_DEV_INCELL=y\nCONFIG_TOUCHSCREEN_SYNAPTICS_DSX_FW_UPDATE=y\nCONFIG_TOUCHSCREEN_SYNAPTICS_DSX_FW_UPDATE_INCELL=y\nCONFIG_TOUCHSCREEN_SYNAPTICS_DSX_TEST_REPORTING_INCELL=y\nCONFIG_TOUCHSCREEN_ATMEL_MXT=y\nCONFIG_TOUCHSCREEN_ATMEL_640T=y\nCONFIG_TOUCHSCREEN_ST_FTS=y\nCONFIG_TOUCHSCREEN_CYTTSP_BUTTON=y\nCONFIG_TOUCHSCREEN_GEN_VKEYS=y\nCONFIG_SECURE_TOUCH=y\nCONFIG_INPUT_MISC=y\nCONFIG_INPUT_HBTP_INPUT=y\nCONFIG_INPUT_KEYCHORD=y\nCONFIG_INPUT_UINPUT=y\nCONFIG_INPUT_GPIO=y\nCONFIG_SERIO_LIBPS2=y\n# CONFIG_VT is not set\n# CONFIG_LEGACY_PTYS is not set\n# CONFIG_DEVMEM is not set\n# CONFIG_DEVKMEM is not set\nCONFIG_SERIAL_MSM_HS=y\nCONFIG_SERIAL_MSM_HSL=y\nCONFIG_DIAG_CHAR=y\nCONFIG_HW_RANDOM=y\nCONFIG_HW_RANDOM_MSM=y\nCONFIG_MSM_ADSPRPC=y\nCONFIG_I2C=y\nCONFIG_I2C_CHARDEV=y\nCONFIG_I2C_QUP=y\nCONFIG_SPI=y\nCONFIG_SPI_QUP=y\nCONFIG_SPMI=y\nCONFIG_SPMI_MSM_PMIC_ARB=y\nCONFIG_MSM_QPNP_INT=y\nCONFIG_SLIMBUS_MSM_NGD=y\nCONFIG_DEBUG_GPIO=y\nCONFIG_GPIO_SYSFS=y\nCONFIG_GPIO_QPNP_PIN=y\nCONFIG_GPIO_QPNP_PIN_DEBUG=y\nCONFIG_SMB350_CHARGER=y\nCONFIG_BATTERY_BQ28400=y\nCONFIG_QPNP_CHARGER=y\nCONFIG_BATTERY_BCL=y\nCONFIG_QPNP_BMS=y\nCONFIG_SENSORS_EPM_ADC=y\nCONFIG_SENSORS_QPNP_ADC_VOLTAGE=y\nCONFIG_SENSORS_QPNP_ADC_CURRENT=y\nCONFIG_THERMAL=y\nCONFIG_THERMAL_TSENS8974=y\nCONFIG_THERMAL_QPNP=y\nCONFIG_THERMAL_QPNP_ADC_TM=y\nCONFIG_THERMAL_MONITOR_SIMPLE=y\nCONFIG_WCD9320_CODEC=y\nCONFIG_REGULATOR_FIXED_VOLTAGE=y\nCONFIG_REGULATOR_STUB=y\nCONFIG_REGULATOR_QPNP=y\nCONFIG_MEDIA_SUPPORT=y\nCONFIG_MEDIA_CONTROLLER=y\nCONFIG_VIDEO_DEV=y\nCONFIG_VIDEO_V4L2_SUBDEV_API=y\n# CONFIG_IR_MCE_KBD_DECODER is not set\nCONFIG_IR_PWM=y\n# CONFIG_MSM_CAMERA is not set\nCONFIG_MSMB_CAMERA=y\nCONFIG_MSM_CAMERA_SENSOR=y\nCONFIG_MSM_CPP=y\nCONFIG_MSM_CCI=y\nCONFIG_MSM_CSI30_HEADER=y\nCONFIG_MSM_CSIPHY=y\nCONFIG_MSM_CSID=y\nCONFIG_MSM_EEPROM=y\nCONFIG_MSM_ISPIF=y\nCONFIG_S5K3M2=y\nCONFIG_IMX214=y\nCONFIG_IMX135=y\nCONFIG_IMX219=y\nCONFIG_IMX132=y\nCONFIG_OV4688=y\nCONFIG_MSMB_JPEG=y\nCONFIG_MSM_VIDC_V4L2=y\nCONFIG_MSM_WFD=y\n# CONFIG_MEDIA_TUNER_SIMPLE is not set\n# CONFIG_MEDIA_TUNER_TDA8290 is not set\n# CONFIG_MEDIA_TUNER_TDA827X is not set\n# CONFIG_MEDIA_TUNER_TDA18271 is not set\n# CONFIG_MEDIA_TUNER_TDA9887 is not set\n# CONFIG_MEDIA_TUNER_TEA5761 is not set\n# CONFIG_MEDIA_TUNER_TEA5767 is not set\n# CONFIG_MEDIA_TUNER_MT20XX is not set\n# CONFIG_MEDIA_TUNER_MT2060 is not set\n# CONFIG_MEDIA_TUNER_MT2063 is not set\n# CONFIG_MEDIA_TUNER_MT2266 is not set\n# CONFIG_MEDIA_TUNER_MT2131 is not set\n# CONFIG_MEDIA_TUNER_QT1010 is not set\n# CONFIG_MEDIA_TUNER_XC2028 is not set\n# CONFIG_MEDIA_TUNER_XC5000 is not set\n# CONFIG_MEDIA_TUNER_XC4000 is not set\n# CONFIG_MEDIA_TUNER_MXL5005S is not set\n# CONFIG_MEDIA_TUNER_MXL5007T is not set\n# CONFIG_MEDIA_TUNER_MC44S803 is not set\n# CONFIG_MEDIA_TUNER_MAX2165 is not set\n# CONFIG_MEDIA_TUNER_TDA18218 is not set\n# CONFIG_MEDIA_TUNER_TDA18212 is not set\nCONFIG_VIDEOBUF2_MSM_MEM=y\nCONFIG_USB_VIDEO_CLASS=y\n# CONFIG_USB_GSPCA is not set\nCONFIG_V4L_PLATFORM_DRIVERS=y\nCONFIG_RADIO_IRIS=y\nCONFIG_RADIO_IRIS_TRANSPORT=y\nCONFIG_ION=y\nCONFIG_ION_MSM=y\nCONFIG_MSM_KGSL=y\nCONFIG_KGSL_PER_PROCESS_PAGE_TABLE=y\nCONFIG_FB=y\nCONFIG_FB_MSM=y\n# CONFIG_FB_MSM_BACKLIGHT is not set\nCONFIG_FB_MSM_MDSS=y\nCONFIG_FB_MSM_MDSS_WRITEBACK=y\nCONFIG_BACKLIGHT_LCD_SUPPORT=y\n# CONFIG_LCD_CLASS_DEVICE is not set\nCONFIG_BACKLIGHT_CLASS_DEVICE=y\n# CONFIG_BACKLIGHT_GENERIC is not set\nCONFIG_SOUND=y\nCONFIG_SND=y\nCONFIG_SND_USB_AUDIO=y\nCONFIG_SND_SOC=y\nCONFIG_SND_SOC_MSM8974=y\nCONFIG_SND_SOC_TPA6130A2=y\nCONFIG_HIDRAW=y\nCONFIG_UHID=y\nCONFIG_HID_A4TECH=y\nCONFIG_HID_ACRUX=y\nCONFIG_HID_ACRUX_FF=y\nCONFIG_HID_APPLE=y\nCONFIG_HID_BELKIN=y\nCONFIG_HID_CHERRY=y\nCONFIG_HID_CHICONY=y\nCONFIG_HID_PRODIKEYS=y\nCONFIG_HID_CYPRESS=y\nCONFIG_HID_DRAGONRISE=y\nCONFIG_DRAGONRISE_FF=y\nCONFIG_HID_EMS_FF=y\nCONFIG_HID_ELECOM=y\nCONFIG_HID_EZKEY=y\nCONFIG_HID_HOLTEK=y\nCONFIG_HID_KEYTOUCH=y\nCONFIG_HID_KYE=y\nCONFIG_HID_UCLOGIC=y\nCONFIG_HID_WALTOP=y\nCONFIG_HID_GYRATION=y\nCONFIG_HID_TWINHAN=y\nCONFIG_HID_KENSINGTON=y\nCONFIG_HID_LCPOWER=y\nCONFIG_HID_LOGITECH=y\nCONFIG_HID_LOGITECH_DJ=y\nCONFIG_LOGITECH_FF=y\nCONFIG_LOGIRUMBLEPAD2_FF=y\nCONFIG_LOGIG940_FF=y\nCONFIG_HID_MAGICMOUSE=y\nCONFIG_HID_MICROSOFT=y\nCONFIG_HID_MONTEREY=y\nCONFIG_HID_MULTITOUCH=y\nCONFIG_HID_NTRIG=y\nCONFIG_HID_ORTEK=y\nCONFIG_HID_PANTHERLORD=y\nCONFIG_PANTHERLORD_FF=y\nCONFIG_HID_PETALYNX=y\nCONFIG_HID_PICOLCD=y\nCONFIG_HID_PRIMAX=y\nCONFIG_HID_ROCCAT=y\nCONFIG_HID_SAITEK=y\nCONFIG_HID_SAMSUNG=y\nCONFIG_HID_SONY=y\nCONFIG_HID_SPEEDLINK=y\nCONFIG_HID_SUNPLUS=y\nCONFIG_HID_GREENASIA=y\nCONFIG_GREENASIA_FF=y\nCONFIG_HID_SMARTJOYPLUS=y\nCONFIG_SMARTJOYPLUS_FF=y\nCONFIG_HID_TIVO=y\nCONFIG_HID_TOPSEED=y\nCONFIG_HID_THRUSTMASTER=y\nCONFIG_HID_WACOM=y\nCONFIG_HID_WIIMOTE=y\nCONFIG_HID_ZEROPLUS=y\nCONFIG_HID_ZYDACRON=y\nCONFIG_HID_SENSOR_HUB=y\nCONFIG_USB_HIDDEV=y\nCONFIG_I2C_HID=y\nCONFIG_USB_ANNOUNCE_NEW_DEVICES=y\nCONFIG_USB_SUSPEND=y\nCONFIG_USB_XHCI_HCD=y\nCONFIG_USB_EHCI_HCD=y\nCONFIG_USB_EHCI_EHSET=y\nCONFIG_USB_EHCI_MSM=y\nCONFIG_USB_EHCI_MSM_HSIC=y\nCONFIG_USB_ACM=y\nCONFIG_USB_STORAGE=y\nCONFIG_USB_STORAGE_DATAFAB=y\nCONFIG_USB_STORAGE_FREECOM=y\nCONFIG_USB_STORAGE_ISD200=y\nCONFIG_USB_STORAGE_USBAT=y\nCONFIG_USB_STORAGE_SDDR09=y\nCONFIG_USB_STORAGE_SDDR55=y\nCONFIG_USB_STORAGE_JUMPSHOT=y\nCONFIG_USB_STORAGE_ALAUDA=y\nCONFIG_USB_STORAGE_ONETOUCH=y\nCONFIG_USB_STORAGE_KARMA=y\nCONFIG_USB_STORAGE_CYPRESS_ATACB=y\nCONFIG_USB_STORAGE_ENE_UB6250=y\nCONFIG_USB_EHSET_TEST_FIXTURE=y\nCONFIG_USB_GADGET=y\nCONFIG_USB_GADGET_DEBUG_FILES=y\nCONFIG_USB_CI13XXX_MSM=y\nCONFIG_USB_DWC3_MSM=y\nCONFIG_USB_G_ANDROID=y\nCONFIG_MMC=y\nCONFIG_MMC_PERF_PROFILING=y\nCONFIG_MMC_UNSAFE_RESUME=y\nCONFIG_MMC_CLKGATE=y\nCONFIG_MMC_PARANOID_SD_INIT=y\nCONFIG_MMC_BLOCK_MINORS=32\n# CONFIG_MMC_BLOCK_BOUNCE is not set\nCONFIG_MMC_SDHCI=y\nCONFIG_MMC_SDHCI_PLTFM=y\nCONFIG_MMC_MSM=y\nCONFIG_MMC_SDHCI_MSM=y\nCONFIG_MMC_MSM_SPS_SUPPORT=y\nCONFIG_LEDS_GPIO=y\nCONFIG_LEDS_QPNP=y\nCONFIG_LEDS_TRIGGERS=y\nCONFIG_LEDS_TRIGGER_BACKLIGHT=y\nCONFIG_LEDS_TRIGGER_DEFAULT_ON=y\nCONFIG_SWITCH=y\nCONFIG_RTC_CLASS=y\n# CONFIG_RTC_DRV_MSM is not set\nCONFIG_RTC_DRV_QPNP=y\nCONFIG_UIO=y\nCONFIG_UIO_MSM_SHAREDMEM=y\nCONFIG_STAGING=y\nCONFIG_ANDROID=y\nCONFIG_ANDROID_BINDER_IPC=y\nCONFIG_ASHMEM=y\nCONFIG_ANDROID_RAM_CONSOLE=y\nCONFIG_ANDROID_TIMED_GPIO=y\nCONFIG_ANDROID_LOW_MEMORY_KILLER=y\nCONFIG_PRONTO_WLAN=y\nCONFIG_PRIMA_WLAN_LFR=y\nCONFIG_PRIMA_WLAN_OKC=y\nCONFIG_PRIMA_WLAN_11AC_HIGH_TP=y\nCONFIG_WLAN_FEATURE_11W=y\nCONFIG_QCOM_VOWIFI_11R=y\nCONFIG_ENABLE_LINUX_REG=y\nCONFIG_QCOM_TDLS=y\nCONFIG_SPS=y\nCONFIG_USB_BAM=y\nCONFIG_SPS_SUPPORT_BAMDMA=y\nCONFIG_SPS_SUPPORT_NDP_BAM=y\nCONFIG_QPNP_PWM=y\nCONFIG_QPNP_POWER_ON=y\nCONFIG_QPNP_CLKDIV=y\nCONFIG_QPNP_REVID=y\nCONFIG_QPNP_COINCELL=y\nCONFIG_MSM_AVTIMER=y\nCONFIG_MSM_IOMMU_V1=y\nCONFIG_MSM_IOMMU_PMON=y\nCONFIG_IOMMU_PGTABLES_L2=y\nCONFIG_MSM_IOMMU_VBIF_CHECK=y\n# CONFIG_ADRENO_IDLER is not set\nCONFIG_BIF=y\nCONFIG_BIF_QPNP=y\nCONFIG_IIO=y\nCONFIG_HID_SENSOR_ACCEL_3D=y\nCONFIG_HID_SENSOR_MOTION_DETECTOR=y\nCONFIG_HID_SENSOR_CUSTOM=y\nCONFIG_HID_SENSOR_GYRO_3D=y\nCONFIG_HID_SENSOR_INCLI_3D=y\nCONFIG_CM36686=y\nCONFIG_HID_SENSOR_MAGNETOMETER_3D=y\nCONFIG_HID_SENSOR_ORIENTATION=y\nCONFIG_HID_SENSOR_DISTANCE=y\nCONFIG_BMP280=y\nCONFIG_BMP280_I2C=y\nCONFIG_EXT4_FS=y\nCONFIG_EXT4_FS_SECURITY=y\nCONFIG_FUSE_FS=y\nCONFIG_MSDOS_FS=y\nCONFIG_VFAT_FS=y\nCONFIG_EXFAT_FS=y\nCONFIG_TMPFS=y\nCONFIG_TMPFS_POSIX_ACL=y\nCONFIG_ECRYPT_FS=y\nCONFIG_CIFS=y\nCONFIG_CONFIGFS_FS=y\nCONFIG_SDCARD_FS=y\nCONFIG_NLS_CODEPAGE_437=y\nCONFIG_NLS_CODEPAGE_936=y\nCONFIG_NLS_CODEPAGE_950=y\nCONFIG_NLS_ASCII=y\nCONFIG_NLS_ISO8859_1=y\nCONFIG_NLS_UTF8=y\nCONFIG_PRINTK_TIME=y\nCONFIG_MAGIC_SYSRQ=y\n# CONFIG_SCHED_DEBUG is not set\nCONFIG_SCHEDSTATS=y\nCONFIG_TIMER_STATS=y\n# CONFIG_DEBUG_PREEMPT is not set\nCONFIG_DEBUG_INFO=y\nCONFIG_FAULT_INJECTION=y\nCONFIG_CPU_FREQ_SWITCH_PROFILER=y\nCONFIG_DYNAMIC_DEBUG=y\nCONFIG_PANIC_ON_DATA_CORRUPTION=y\nCONFIG_PID_IN_CONTEXTIDR=y\nCONFIG_KEYS=y\nCONFIG_SECURITY_PERF_EVENTS_RESTRICT=y\nCONFIG_SECURITY=y\nCONFIG_SECURITY_NETWORK=y\nCONFIG_LSM_MMAP_MIN_ADDR=4096\nCONFIG_SECURITY_SELINUX=y\nCONFIG_CRYPTO_NULL=y\nCONFIG_CRYPTO_XCBC=y\nCONFIG_CRYPTO_SHA1_ARM_NEON=y\nCONFIG_CRYPTO_SHA512_ARM_NEON=y\nCONFIG_CRYPTO_AES_ARM_BS=y\nCONFIG_CRYPTO_TWOFISH=y\n# CONFIG_CRYPTO_ANSI_CPRNG is not set\nCONFIG_CRYPTO_DEV_QCRYPTO=y\nCONFIG_CRYPTO_DEV_QCE=y\nCONFIG_CRYPTO_DEV_QCEDEV=y\n\n# CONFIG_VP\nCONFIG_VP=y\n"
  },
  {
    "path": "VirtualPosition/vp_KernelDriver/vp/Kconfig",
    "content": " config VP\n           tristate \"Virtual Position Driver\"\n           default n\n           help\n           This is the virtual position driver.\n"
  },
  {
    "path": "VirtualPosition/vp_KernelDriver/vp/Makefile",
    "content": "obj-$(CONFIG_VP) += vp.o\n"
  },
  {
    "path": "VirtualPosition/vp_KernelDriver/vp/vp.c",
    "content": "/*******************************************\n*include file and define functions\n*******************************************/\n#include <linux/init.h>  \n#include <linux/module.h>  \n#include <linux/types.h>  \n#include <linux/fs.h>  \n#include <linux/proc_fs.h>  \n#include <linux/device.h>  \n#include <asm/uaccess.h>  \n  \n#include \"vp.h\"  \n  \n/*主设备和从设备号变量*/  \nstatic int vp_major = 0;  \nstatic int vp_minor = 0;  \n  \n/*设备类别和设备变量*/  \nstatic struct class* vp_class = NULL;  \nstatic struct vp_android_dev* vp_dev = NULL;  \n  \n/*传统的设备文件操作方法*/  \nstatic int vp_open(struct inode* inode, struct file* filp);  \nstatic int vp_release(struct inode* inode, struct file* filp);  \nstatic ssize_t vp_read(struct file* filp, char __user *buf, size_t count, loff_t* f_pos);  \nstatic ssize_t vp_write(struct file* filp, const char __user *buf, size_t count, loff_t* f_pos);  \n  \n/*设备文件操作方法表*/  \nstatic struct file_operations vp_fops = {  \n    .owner = THIS_MODULE,  \n    .open = vp_open,  \n    .release = vp_release,  \n    .read = vp_read,  \n    .write = vp_write,   \n};  \n  \n/*访问设置属性方法*/  \nstatic ssize_t vp_lamp_show(struct device* dev, struct device_attribute* attr,  char* buf);  \nstatic ssize_t vp_lamp_store(struct device* dev, struct device_attribute* attr, const char* buf, size_t count);  \n  \n/*定义设备属性*/  \nstatic DEVICE_ATTR(val, S_IRUGO | S_IWUSR, vp_lamp_show, vp_lamp_store);\n\n/*******************************************\n*define traditional file access \n*******************************************/\n/*打开设备方法*/  \nstatic int vp_open(struct inode* inode, struct file* filp) {  \n    struct vp_android_dev* dev;          \n      \n    /*将自定义设备结构体保存在文件指针的私有数据域中，以便访问设备时拿来用*/  \n    dev = container_of(inode->i_cdev, struct vp_android_dev, dev);  \n    filp->private_data = dev;  \n      \n    return 0;  \n}  \n  \n/*设备文件释放时调用，空实现*/  \nstatic int vp_release(struct inode* inode, struct file* filp) {  \n    return 0;  \n}  \n  \n/*读取设备的寄存器val的值*/  \nstatic ssize_t vp_read(struct file* filp, char __user *buf, size_t count, loff_t* f_pos) {  \n    ssize_t err = 0;  \n    struct vp_android_dev* dev = filp->private_data;          \n  \n    /*同步访问*/  \n    if(down_interruptible(&(dev->sem))) {  \n        return -ERESTARTSYS;  \n    }  \n  \n    if(count < sizeof(dev->val)) {  \n        goto out;  \n    }          \n  \n    /*将寄存器val的值拷贝到用户提供的缓冲区*/  \n    if(copy_to_user(buf, &(dev->val), sizeof(dev->val))) {  \n        err = -EFAULT;  \n        goto out;  \n    }  \n  \n    err = sizeof(dev->val);  \n  \nout:  \n    up(&(dev->sem));  \n    return err;  \n}  \n  \n/*写设备的寄存器值val*/  \nstatic ssize_t vp_write(struct file* filp, const char __user *buf, size_t count, loff_t* f_pos) {  \n    struct vp_android_dev* dev = filp->private_data;  \n    ssize_t err = 0;          \n  \n    /*同步访问*/  \n    if(down_interruptible(&(dev->sem))) {  \n        return -ERESTARTSYS;          \n    }          \n  \n    if(count != sizeof(dev->val)) {  \n        goto out;          \n    }          \n  \n    /*将用户提供的缓冲区的值写到设备寄存器去*/  \n    if(copy_from_user(&(dev->val), buf, count)) {  \n        err = -EFAULT;  \n        goto out;  \n    }  \n  \n    err = sizeof(dev->val);  \n  \nout:  \n    up(&(dev->sem));  \n    return err;  \n}  \n\n/*******************************************\n*define devfs access\n*******************************************/\n/*读取寄存器lamp的值到缓冲区buf中，内部使用*/  \nstatic ssize_t __vp_get_lamp(struct vp_android_dev* dev, char* buf) {  \n    int lamp = 0;          \n  \n    /*同步访问*/  \n    if(down_interruptible(&(dev->sem))) {                  \n        return -ERESTARTSYS;          \n    }          \n  \n    lamp = dev->lamp;          \n    up(&(dev->sem));          \n  \n    return snprintf(buf, PAGE_SIZE, \"%d\\n\", lamp);  \n}  \n  \n/*把缓冲区buf的值写到设备寄存器lamp中去，内部使用*/  \nstatic ssize_t __vp_set_lamp(struct vp_android_dev* dev, const char* buf, size_t count) {  \n    int lamp = 0;          \n  \n    /*将字符串转换成数字*/          \n    lamp = simple_strtol(buf, NULL, 10);          \n  \n    /*同步访问*/          \n    if(down_interruptible(&(dev->sem))) {                  \n        return -ERESTARTSYS;          \n    }          \n  \n    dev->lamp = lamp;          \n    up(&(dev->sem));  \n  \n    return count;  \n}  \n  \n/*读取设备属性lamp*/  \nstatic ssize_t vp_lamp_show(struct device* dev, struct device_attribute* attr, char* buf) {  \n    struct vp_android_dev* hdev = (struct vp_android_dev*)dev_get_drvdata(dev);          \n  \n    return __vp_get_lamp(hdev, buf);  \n}  \n  \n/*写设备属性lamp*/  \nstatic ssize_t vp_lamp_store(struct device* dev, struct device_attribute* attr, const char* buf, size_t count) {   \n    struct vp_android_dev* hdev = (struct vp_android_dev*)dev_get_drvdata(dev);    \n      \n    return __vp_set_lamp(hdev, buf, count);  \n}  \n\n/*******************************************\n*define proc access\n*******************************************/\n/*读取设备寄存器lamp的值，保存在page缓冲区中*/  \nstatic ssize_t vp_proc_read(char* page, char** start, off_t off, int count, int* eof, void* data) {  \n    if(off > 0) {  \n        *eof = 1;  \n        return 0;  \n    }  \n  \n    return __vp_get_lamp(vp_dev, page);  \n}  \n  \n/*把缓冲区的值buff保存到设备寄存器lamp中去*/  \nstatic ssize_t vp_proc_write(struct file* filp, const char __user *buff, unsigned long len, void* data) {  \n    int err = 0;  \n    char* page = NULL;  \n  \n    if(len > PAGE_SIZE) {  \n        printk(KERN_ALERT\"The buff is too large: %lu.\\n\", len);  \n        return -EFAULT;  \n    }  \n  \n    page = (char*)__get_free_page(GFP_KERNEL);  \n    if(!page) {                  \n        printk(KERN_ALERT\"Failed to alloc page.\\n\");  \n        return -ENOMEM;  \n    }          \n  \n    /*先把用户提供的缓冲区值拷贝到内核缓冲区中去*/  \n    if(copy_from_user(page, buff, len)) {  \n        printk(KERN_ALERT\"Failed to copy buff from user.\\n\");                  \n        err = -EFAULT;  \n        goto out;  \n    }  \n  \n    err = __vp_set_lamp(vp_dev, page, len);  \n  \nout:  \n    free_page((unsigned long)page);  \n    return err;  \n}  \n  \n/*创建/proc/vp文件*/  \nstatic void vp_create_proc(void) {\n\tstruct proc_dir_entry *entry;\n\tentry = create_proc_entry(VP_DEVICE_PROC_NAME, 0, NULL);\n\tif(entry)\n\t{\n\t\tentry->read_proc = vp_proc_read;\n\t\tentry->write_proc = vp_proc_write;\n\t}\n}  \n  \n/*删除/proc/vp文件*/  \nstatic void vp_remove_proc(void) {  \n    remove_proc_entry(VP_DEVICE_PROC_NAME, NULL);  \n}  \n\n/*******************************************\n*define load and remove function\n*******************************************/\n/*初始化设备*/  \nstatic int  __vp_setup_dev(struct vp_android_dev* dev) {  \n    int err;  \n    dev_t devno = MKDEV(vp_major, vp_minor);  \n  \n    memset(dev, 0, sizeof(struct vp_android_dev));  \n  \n    cdev_init(&(dev->dev), &vp_fops);  \n    dev->dev.owner = THIS_MODULE;  \n    dev->dev.ops = &vp_fops;          \n  \n    /*注册字符设备*/  \n    err = cdev_add(&(dev->dev),devno, 1);  \n    if(err) {  \n        return err;  \n    }          \n  \n    /*初始化信号量和寄存器lamp, val的值*/  \n    sema_init(&(dev->sem), 1);  \n    dev->lamp = 7777;  \n    dev->val.toggle = 1;  \n    dev->val.virtual_latitude = 45.104108; \n    dev->val.virtual_longitude = 130.816878; \n \n    return 0;  \n}  \n  \n/*模块加载方法*/  \nstatic int __init vp_init(void){   \n    int err = -1;  \n    dev_t dev = 0;  \n    struct device* temp = NULL;  \n  \n    printk(KERN_ALERT\"Initializing vp device.\\n\");          \n  \n    /*动态分配主设备和从设备号*/  \n    err = alloc_chrdev_region(&dev, 0, 1, VP_DEVICE_NODE_NAME);  \n    if(err < 0) {  \n        printk(KERN_ALERT\"Failed to alloc char dev region.\\n\");  \n        goto fail;  \n    }  \n  \n    vp_major = MAJOR(dev);  \n    vp_minor = MINOR(dev);          \n  \n    /*分配helo设备结构体变量*/  \n    vp_dev = kmalloc(sizeof(struct vp_android_dev), GFP_KERNEL);  \n    if(!vp_dev) {  \n        err = -ENOMEM;  \n        printk(KERN_ALERT\"Failed to alloc vp_dev.\\n\");  \n        goto unregister;  \n    }          \n  \n    /*初始化设备*/  \n    err = __vp_setup_dev(vp_dev);  \n    if(err) {  \n        printk(KERN_ALERT\"Failed to setup dev: %d.\\n\", err);  \n        goto cleanup;  \n    }          \n  \n    /*在/sys/class/目录下创建设备类别目录vp*/  \n    vp_class = class_create(THIS_MODULE, VP_DEVICE_CLASS_NAME);  \n    if(IS_ERR(vp_class)) {  \n        err = PTR_ERR(vp_class);  \n        printk(KERN_ALERT\"Failed to create vp class.\\n\");  \n        goto destroy_cdev;  \n    }          \n  \n    /*在/dev/目录和/sys/class/vp目录下分别创建设备文件vp*/  \n    temp = device_create(vp_class, NULL, dev, \"%s\", VP_DEVICE_FILE_NAME);  \n    if(IS_ERR(temp)) {  \n        err = PTR_ERR(temp);  \n        printk(KERN_ALERT\"Failed to create vp device.\");  \n        goto destroy_class;  \n    }          \n  \n    /*在/sys/class/vp/vp目录下创建属性文件val*/  \n    err = device_create_file(temp, &dev_attr_val);  \n    if(err < 0) {  \n        printk(KERN_ALERT\"Failed to create attribute val.\");                  \n        goto destroy_device;  \n    }  \n  \n    dev_set_drvdata(temp, vp_dev);          \n  \n    /*创建/proc/vp文件*/  \n    vp_create_proc();  \n  \n    printk(KERN_ALERT\"Succedded to initialize vp device.\\n\");  \n    return 0;  \n  \ndestroy_device:  \n    device_destroy(vp_class, dev);  \n  \ndestroy_class:  \n    class_destroy(vp_class);  \n  \ndestroy_cdev:  \n    cdev_del(&(vp_dev->dev));  \n  \ncleanup:  \n    kfree(vp_dev);  \n  \nunregister:  \n    unregister_chrdev_region(MKDEV(vp_major, vp_minor), 1);  \n  \nfail:  \n    return err;  \n}  \n  \n/*模块卸载方法*/  \nstatic void __exit vp_exit(void) {  \n    dev_t devno = MKDEV(vp_major, vp_minor);  \n  \n    printk(KERN_ALERT\"Destroy vp device.\\n\");          \n  \n    /*删除/proc/vp文件*/  \n    vp_remove_proc();          \n  \n    /*销毁设备类别和设备*/  \n    if(vp_class) {  \n        device_destroy(vp_class, MKDEV(vp_major, vp_minor));  \n        class_destroy(vp_class);  \n    }          \n  \n    /*删除字符设备和释放设备内存*/  \n    if(vp_dev) {  \n        cdev_del(&(vp_dev->dev));  \n        kfree(vp_dev);  \n    }          \n  \n    /*释放设备号*/  \n    unregister_chrdev_region(devno, 1);  \n}  \n  \nMODULE_LICENSE(\"GPL\");  \nMODULE_DESCRIPTION(\"Virtualposition Driver\");  \n  \nmodule_init(vp_init);  \nmodule_exit(vp_exit);  \n"
  },
  {
    "path": "VirtualPosition/vp_KernelDriver/vp/vp.h",
    "content": "#ifndef _VP_ANDROID_H_  \n#define _VP_ANDROID_H_  \n  \n#include <linux/cdev.h>  \n#include <linux/semaphore.h>  \n  \n#define VP_DEVICE_NODE_NAME  \"vp\"  \n#define VP_DEVICE_FILE_NAME  \"vp\"  \n#define VP_DEVICE_PROC_NAME  \"vp\"  \n#define VP_DEVICE_CLASS_NAME \"vp\"  \n  \ntypedef struct {\n    int toggle;\n    double virtual_latitude;\n    double virtual_longitude;\n} VirtualPosition;\n\n\nstruct vp_android_dev {  \n    int lamp;\n    VirtualPosition val;\n    struct semaphore sem;  \n    struct cdev dev;  \n};  \n  \n#endif  \n"
  }
]