Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions fastboot/device/variables.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -339,8 +339,8 @@ bool GetPartitionType(FastbootDevice* device, const std::vector<std::string>& ar

auto fastboot_hal = device->fastboot_hal();
if (!fastboot_hal) {
*message = "Fastboot HAL not found";
return false;
*message = "raw";
return true;
}

FileSystemType type;
Expand Down
2 changes: 1 addition & 1 deletion fs_mgr/clean_scratch_files.rc
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
on post-fs-data && property:ro.debuggable=1
on post-fs-data && property:ro.debuggable=1 && property:ro.boot.dynamic_partitions=true
exec_background - root root -- /system/bin/clean_scratch_files
1 change: 1 addition & 0 deletions fs_mgr/fs_mgr_fstab.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ void ParseFsMgrFlags(const std::string& flags, FstabEntry* entry) {
CheckFlag("fsverity", fs_verity);
CheckFlag("metadata_csum", ext_meta_csum);
CheckFlag("fscompress", fs_compress);
CheckFlag("wrappedkey", wrapped_key);

#undef CheckFlag

Expand Down
1 change: 1 addition & 0 deletions fs_mgr/include_fstab/fstab/fstab.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ struct FstabEntry {
bool fs_verity : 1;
bool ext_meta_csum : 1;
bool fs_compress : 1;
bool wrapped_key : 1;
} fs_mgr_flags = {};

bool is_encryptable() const {
Expand Down
41 changes: 38 additions & 3 deletions healthd/BatteryMonitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -190,12 +190,15 @@ BatteryMonitor::PowerSupplyType BatteryMonitor::readPowerSupplyType(const String
{"USB", ANDROID_POWER_SUPPLY_TYPE_USB},
{"USB_DCP", ANDROID_POWER_SUPPLY_TYPE_AC},
{"USB_HVDCP", ANDROID_POWER_SUPPLY_TYPE_AC},
{"USB_HVDCP_3", ANDROID_POWER_SUPPLY_TYPE_AC},
{"USB_HVDCP_3P5", ANDROID_POWER_SUPPLY_TYPE_AC},
{"USB_CDP", ANDROID_POWER_SUPPLY_TYPE_AC},
{"USB_ACA", ANDROID_POWER_SUPPLY_TYPE_AC},
{"USB_C", ANDROID_POWER_SUPPLY_TYPE_AC},
{"USB_PD", ANDROID_POWER_SUPPLY_TYPE_AC},
{"USB_PD_DRP", ANDROID_POWER_SUPPLY_TYPE_USB},
{"Wireless", ANDROID_POWER_SUPPLY_TYPE_WIRELESS},
{"DASH", ANDROID_POWER_SUPPLY_TYPE_AC},
{NULL, 0},
};
std::string buf;
Expand All @@ -204,10 +207,8 @@ BatteryMonitor::PowerSupplyType BatteryMonitor::readPowerSupplyType(const String
return ANDROID_POWER_SUPPLY_TYPE_UNKNOWN;

auto ret = mapSysfsString(buf.c_str(), supplyTypeMap);
if (!ret) {
KLOG_WARNING(LOG_TAG, "Unknown power supply type '%s'\n", buf.c_str());
if (!ret)
*ret = ANDROID_POWER_SUPPLY_TYPE_UNKNOWN;
}

return static_cast<BatteryMonitor::PowerSupplyType>(*ret);
}
Expand Down Expand Up @@ -301,6 +302,40 @@ void BatteryMonitor::updateValues(void) {

double MaxPower = 0;

// Rescan for the available charger types
std::unique_ptr<DIR, decltype(&closedir)> dir(opendir(POWER_SUPPLY_SYSFS_PATH), closedir);
if (dir == NULL) {
KLOG_ERROR(LOG_TAG, "Could not open %s\n", POWER_SUPPLY_SYSFS_PATH);
} else {
struct dirent* entry;
String8 path;

mChargerNames.clear();

while ((entry = readdir(dir.get()))) {
const char* name = entry->d_name;

if (!strcmp(name, ".") || !strcmp(name, ".."))
continue;

// Look for "type" file in each subdirectory
path.clear();
path.appendFormat("%s/%s/type", POWER_SUPPLY_SYSFS_PATH, name);
switch(BatteryMonitor::readPowerSupplyType(path)) {
case ANDROID_POWER_SUPPLY_TYPE_AC:
case ANDROID_POWER_SUPPLY_TYPE_USB:
case ANDROID_POWER_SUPPLY_TYPE_WIRELESS:
path.clear();
path.appendFormat("%s/%s/online", POWER_SUPPLY_SYSFS_PATH, name);
if (access(path.string(), R_OK) == 0)
mChargerNames.add(String8(name));
break;
default:
break;
}
}
}

for (size_t i = 0; i < mChargerNames.size(); i++) {
String8 path;
path.appendFormat("%s/%s/online", POWER_SUPPLY_SYSFS_PATH,
Expand Down
9 changes: 9 additions & 0 deletions init/Android.bp
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,14 @@ init_host_sources = [
"host_init_verifier.cpp",
]

cc_library_static {
name: "vendor_init",
recovery_available: true,
srcs: [
"vendor_init.cpp",
],
}

soong_config_module_type {
name: "libinit_cc_defaults",
module_type: "cc_defaults",
Expand Down Expand Up @@ -203,6 +211,7 @@ cc_library_static {
defaults: [
"init_defaults",
"selinux_policy_version",
"vendor_init_defaults",
],
srcs: init_common_sources + init_device_sources,
generated_sources: [
Expand Down
26 changes: 26 additions & 0 deletions init/NOTICE
Original file line number Diff line number Diff line change
Expand Up @@ -188,3 +188,29 @@

END OF TERMS AND CONDITIONS

Copyright (c) 2013, The Linux Foundation. All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided
with the distribution.
* Neither the name of The Linux Foundation nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
12 changes: 9 additions & 3 deletions init/mount_handler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,18 @@ void SetMountProperty(const MountHandlerEntry& entry, bool add) {
auto mount_prop = entry.mount_point;
if (mount_prop == "/") mount_prop = "/root";
std::replace(mount_prop.begin(), mount_prop.end(), '/', '.');
mount_prop = "dev.mnt.blk" + mount_prop;
auto blk_mount_prop = "dev.mnt.blk" + mount_prop;
auto dev_mount_prop = "dev.mnt.dev" + mount_prop;
// Set property even if its value does not change to trigger 'on property:'
// handling, except for clearing non-existent or already clear property.
// Goal is reduction of empty properties and associated triggers.
if (value.empty() && android::base::GetProperty(mount_prop, "").empty()) return;
android::base::SetProperty(mount_prop, value);
if (value.empty() && android::base::GetProperty(blk_mount_prop, "").empty()) return;
android::base::SetProperty(blk_mount_prop, value);
if (!value.empty()) {
android::base::SetProperty(dev_mount_prop, entry.blk_device.substr(strlen(devblock)));
} else {
android::base::SetProperty(dev_mount_prop, "");
}
}

} // namespace
Expand Down
17 changes: 17 additions & 0 deletions init/property_service.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@
#include "subcontext.h"
#include "system/core/init/property_service.pb.h"
#include "util.h"
#include "vendor_init.h"

using namespace std::literals;

Expand Down Expand Up @@ -1097,6 +1098,9 @@ void PropertyLoadBootDefaults() {
}
}

// Update with vendor-specific property runtime overrides
vendor_load_properties();

property_initialize_ro_product_props();
property_initialize_build_id();
property_derive_build_fingerprint();
Expand Down Expand Up @@ -1247,6 +1251,13 @@ static void ProcessBootconfig() {
});
}

static void SetSafetyNetProps() {
InitPropertySet("ro.boot.flash.locked", "1");
InitPropertySet("ro.boot.verifiedbootstate", "green");
InitPropertySet("ro.boot.veritymode", "enforcing");
InitPropertySet("ro.boot.vbmeta.device_state", "locked");
}

void PropertyInit() {
selinux_callback cb;
cb.func_audit = PropertyAuditCallback;
Expand All @@ -1261,6 +1272,12 @@ void PropertyInit() {
LOG(FATAL) << "Failed to load serialized property info file";
}

// Report a valid verified boot chain to make Google SafetyNet integrity
// checks pass. This needs to be done before parsing the kernel cmdline as
// these properties are read-only and will be set to invalid values with
// androidboot cmdline arguments.
SetSafetyNetProps();

// If arguments are passed both on the command line and in DT,
// properties set in DT always have priority over the command-line ones.
ProcessKernelDt();
Expand Down
19 changes: 12 additions & 7 deletions init/service.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,18 @@ static Result<std::string> ComputeContextFromExecutable(const std::string& servi
free(new_con);
}
if (rc == 0 && computed_context == mycon.get()) {
return Error() << "File " << service_path << "(labeled \"" << filecon.get()
<< "\") has incorrect label or no domain transition from " << mycon.get()
<< " to another SELinux domain defined. Have you configured your "
"service correctly? https://source.android.com/security/selinux/"
"device-policy#label_new_services_and_address_denials. Note: this "
"error shows up even in permissive mode in order to make auditing "
"denials possible.";
std::string error = StringPrintf(
"File %s (labeled \"%s\") has incorrect label or no domain transition from %s to "
"another SELinux domain defined. Have you configured your "
"service correctly? https://source.android.com/security/selinux/"
"device-policy#label_new_services_and_address_denials. Note: this "
"error shows up even in permissive mode in order to make auditing "
"denials possible.",
service_path.c_str(), filecon.get(), mycon.get());
if (security_getenforce() != 0) {
return Error() << error;
}
LOG(ERROR) << error;
}
if (rc < 0) {
return Error() << "Could not get process context";
Expand Down
37 changes: 37 additions & 0 deletions init/vendor_init.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
Copyright (c) 2013, The Linux Foundation. All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided
with the distribution.
* Neither the name of The Linux Foundation nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

#include "vendor_init.h"

/* init vendor override stubs */

__attribute__ ((weak))
void vendor_load_properties()
{
}
33 changes: 33 additions & 0 deletions init/vendor_init.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
Copyright (c) 2013, The Linux Foundation. All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided
with the distribution.
* Neither the name of The Linux Foundation nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

#ifndef __INIT_VENDOR__H__
#define __INIT_VENDOR__H__
extern void vendor_load_properties(void);
#endif /* __INIT_VENDOR__H__ */
53 changes: 52 additions & 1 deletion libsystem/include/system/camera.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,20 @@ enum {
// Notify on autofocus start and stop. This is useful in continuous
// autofocus - FOCUS_MODE_CONTINUOUS_VIDEO and FOCUS_MODE_CONTINUOUS_PICTURE.
CAMERA_MSG_FOCUS_MOVE = 0x0800, // notifyCallback
CAMERA_MSG_VENDOR_START = 0x1000,
CAMERA_MSG_STATS_DATA = CAMERA_MSG_VENDOR_START,
CAMERA_MSG_META_DATA = 0x2000,
CAMERA_MSG_VENDOR_END = 0x8000,
CAMERA_MSG_ALL_MSGS = 0xFFFF
};

/** meta data type in CameraMetaDataCallback */
enum {
CAMERA_META_DATA_ASD = 0x001, //ASD data
CAMERA_META_DATA_FD = 0x002, //FD/FP data
CAMERA_META_DATA_HDR = 0x003, //Auto HDR data
};

/** cmdType in sendCommand functions */
enum {
CAMERA_CMD_START_SMOOTH_ZOOM = 1,
Expand Down Expand Up @@ -189,7 +200,25 @@ enum {
* IMPLEMENTATION_DEFINED, then HALv3 devices will use gralloc usage flags
* of SW_READ_OFTEN.
*/
CAMERA_CMD_SET_VIDEO_FORMAT = 11
CAMERA_CMD_SET_VIDEO_FORMAT = 11,

CAMERA_CMD_VENDOR_START = 20,
/**
* Commands to enable/disable preview histogram
*
* Based on user's input to enable/disable histogram from the camera
* UI, send the appropriate command to the HAL to turn on/off the histogram
* stats and start sending the data to the application.
*/
CAMERA_CMD_HISTOGRAM_ON = CAMERA_CMD_VENDOR_START,
CAMERA_CMD_HISTOGRAM_OFF = CAMERA_CMD_VENDOR_START + 1,
CAMERA_CMD_HISTOGRAM_SEND_DATA = CAMERA_CMD_VENDOR_START + 2,
CAMERA_CMD_LONGSHOT_ON = CAMERA_CMD_VENDOR_START + 3,
CAMERA_CMD_LONGSHOT_OFF = CAMERA_CMD_VENDOR_START + 4,
CAMERA_CMD_STOP_LONGSHOT = CAMERA_CMD_VENDOR_START + 5,
CAMERA_CMD_METADATA_ON = CAMERA_CMD_VENDOR_START + 6,
CAMERA_CMD_METADATA_OFF = CAMERA_CMD_VENDOR_START + 7,
CAMERA_CMD_VENDOR_END = 200,
};

/** camera fatal errors */
Expand Down Expand Up @@ -284,9 +313,31 @@ typedef struct camera_face {
* -2000, -2000 if this is not supported.
*/
int32_t mouth[2];
int32_t smile_degree;
int32_t smile_score;
int32_t blink_detected;
int32_t face_recognised;
int32_t gaze_angle;
int32_t updown_dir;
int32_t leftright_dir;
int32_t roll_dir;
int32_t left_right_gaze;
int32_t top_bottom_gaze;
int32_t leye_blink;
int32_t reye_blink;

} camera_face_t;

/**
* The information of a data type received in a camera frame.
*/
typedef enum {
/** Data buffer */
CAMERA_FRAME_DATA_BUF = 0x000,
/** File descriptor */
CAMERA_FRAME_DATA_FD = 0x100
} camera_frame_data_type_t;

/**
* The metadata of the frame data.
*/
Expand Down
Loading