universal7885: Remove parts/its hal, remenants

This commit is contained in:
roynatech2544 2023-07-16 19:32:10 +09:00
commit c55b034a4b
No known key found for this signature in database
GPG key ID: 389DAC92CAECBBCC
126 changed files with 0 additions and 4784 deletions

View file

@ -1,26 +0,0 @@
aidl_interface {
name: "vendor.eureka.hardware.parts",
srcs: ["vendor/eureka/hardware/parts/*.aidl"],
stability: "vintf",
owner: "Eureka Team",
backend: {
ndk: {
enabled: true,
},
java: {
platform_apis: true,
},
},
versions_with_info: [
{
version: "1",
imports: [],
},
{
version: "2",
imports: [],
},
],
}

View file

@ -1 +0,0 @@
48bdd89bd2780de4c4254e0d52a8c4e53e416d00

View file

@ -1,26 +0,0 @@
// Copyright (C) 2022 Eureka Team
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package vendor.eureka.hardware.parts;
@Backing(type="int")
@VintfStability
enum BatterySys {
CAPACITY_MAX,
TEMP,
CAPACITY_CURRENT,
CURRENT,
FASTCHARGE,
CHARGE,
}

View file

@ -1,22 +0,0 @@
// Copyright (C) 2022 Eureka Team
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package vendor.eureka.hardware.parts;
@Backing(type="int")
@VintfStability
enum DisplaySys {
DOUBLE_TAP,
GLOVE_MODE,
}

View file

@ -1,24 +0,0 @@
// Copyright (C) 2022 Eureka Team
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package vendor.eureka.hardware.parts;
import vendor.eureka.hardware.parts.BatterySys;
@VintfStability
interface IBatteryStats {
int getBatteryStats(in BatterySys stats);
oneway void setBatteryWritable(in BatterySys stats, in boolean value);
}

View file

@ -1,20 +0,0 @@
// Copyright (C) 2022 Eureka Team
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package vendor.eureka.hardware.parts;
@VintfStability
interface IBoolCallback {
void respondToBool(in boolean result);
}

View file

@ -1,22 +0,0 @@
// Copyright (C) 2022 Eureka Team
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package vendor.eureka.hardware.parts;
import vendor.eureka.hardware.parts.DisplaySys;
@VintfStability
interface IDisplayConfigs {
oneway void writeDisplay(in boolean enable, in DisplaySys type);
}

View file

@ -1,24 +0,0 @@
// Copyright (C) 2022 Eureka Team
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package vendor.eureka.hardware.parts;
@VintfStability
interface IFlashBrightness {
int readFlashlightstats(in boolean s2mu106);
oneway void setFlashlightEnable(in boolean enable);
oneway void setFlashlightWritable(in int value);
}

View file

@ -1,28 +0,0 @@
// Copyright (C) 2022 Eureka Team
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package vendor.eureka.hardware.parts;
@VintfStability
interface ISmartCharge {
int getLimitCnt();
int getRestartCnt();
oneway void setConfig(in int limit, in int restart);
oneway void start();
oneway void stop();
}

View file

@ -1,31 +0,0 @@
// Copyright (C) 2022 Eureka Team
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package vendor.eureka.hardware.parts;
import vendor.eureka.hardware.parts.IBoolCallback;
@VintfStability
interface ISwapOnData {
boolean isMutexLocked();
oneway void removeSwapFile();
oneway void setSwapOff();
oneway void setSwapOn(in IBoolCallback cb);
oneway void makeSwapFile(in int size);
}

View file

@ -1 +0,0 @@
dad5105afc869ca8a3c4621e51c4e575b1425e0c

View file

@ -1,41 +0,0 @@
// Copyright (C) 2022 Eureka Team
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
///////////////////////////////////////////////////////////////////////////////
// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
///////////////////////////////////////////////////////////////////////////////
// This file is a snapshot of an AIDL file. Do not edit it manually. There are
// two cases:
// 1). this is a frozen version file - do not edit this in any case.
// 2). this is a 'current' file. If you make a backwards compatible change to
// the interface (from the latest frozen version), the build system will
// prompt you to update this file with `m <name>-update-api`.
//
// You must not make a backward incompatible change to any AIDL file built
// with the aidl_interface module type with versions property set. The module
// type is used to build AIDL files in a way that they can be used across
// independently updatable components of the system. If a device is shipped
// with such a backward incompatible change, it has a high risk of breaking
// later when a module using the interface is updated, e.g., Mainline modules.
package vendor.eureka.hardware.parts;
@Backing(type="int") @VintfStability
enum BatterySys {
CAPACITY_MAX = 0,
TEMP = 1,
CAPACITY_CURRENT = 2,
CURRENT = 3,
FASTCHARGE = 4,
CHARGE = 5,
}

View file

@ -1,37 +0,0 @@
// Copyright (C) 2022 Eureka Team
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
///////////////////////////////////////////////////////////////////////////////
// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
///////////////////////////////////////////////////////////////////////////////
// This file is a snapshot of an AIDL file. Do not edit it manually. There are
// two cases:
// 1). this is a frozen version file - do not edit this in any case.
// 2). this is a 'current' file. If you make a backwards compatible change to
// the interface (from the latest frozen version), the build system will
// prompt you to update this file with `m <name>-update-api`.
//
// You must not make a backward incompatible change to any AIDL file built
// with the aidl_interface module type with versions property set. The module
// type is used to build AIDL files in a way that they can be used across
// independently updatable components of the system. If a device is shipped
// with such a backward incompatible change, it has a high risk of breaking
// later when a module using the interface is updated, e.g., Mainline modules.
package vendor.eureka.hardware.parts;
@Backing(type="int") @VintfStability
enum DisplaySys {
DOUBLE_TAP = 0,
GLOVE_MODE = 1,
}

View file

@ -1,37 +0,0 @@
// Copyright (C) 2022 Eureka Team
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
///////////////////////////////////////////////////////////////////////////////
// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
///////////////////////////////////////////////////////////////////////////////
// This file is a snapshot of an AIDL file. Do not edit it manually. There are
// two cases:
// 1). this is a frozen version file - do not edit this in any case.
// 2). this is a 'current' file. If you make a backwards compatible change to
// the interface (from the latest frozen version), the build system will
// prompt you to update this file with `m <name>-update-api`.
//
// You must not make a backward incompatible change to any AIDL file built
// with the aidl_interface module type with versions property set. The module
// type is used to build AIDL files in a way that they can be used across
// independently updatable components of the system. If a device is shipped
// with such a backward incompatible change, it has a high risk of breaking
// later when a module using the interface is updated, e.g., Mainline modules.
package vendor.eureka.hardware.parts;
@VintfStability
interface IBatteryStats {
int getBatteryStats(in vendor.eureka.hardware.parts.BatterySys stats);
oneway void setBatteryWritable(in vendor.eureka.hardware.parts.BatterySys stats, in boolean value);
}

View file

@ -1,36 +0,0 @@
// Copyright (C) 2022 Eureka Team
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
///////////////////////////////////////////////////////////////////////////////
// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
///////////////////////////////////////////////////////////////////////////////
// This file is a snapshot of an AIDL file. Do not edit it manually. There are
// two cases:
// 1). this is a frozen version file - do not edit this in any case.
// 2). this is a 'current' file. If you make a backwards compatible change to
// the interface (from the latest frozen version), the build system will
// prompt you to update this file with `m <name>-update-api`.
//
// You must not make a backward incompatible change to any AIDL file built
// with the aidl_interface module type with versions property set. The module
// type is used to build AIDL files in a way that they can be used across
// independently updatable components of the system. If a device is shipped
// with such a backward incompatible change, it has a high risk of breaking
// later when a module using the interface is updated, e.g., Mainline modules.
package vendor.eureka.hardware.parts;
@VintfStability
interface IBoolCallback {
void respondToBool(in boolean result);
}

View file

@ -1,37 +0,0 @@
// Copyright (C) 2022 Eureka Team
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
///////////////////////////////////////////////////////////////////////////////
// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
///////////////////////////////////////////////////////////////////////////////
// This file is a snapshot of an AIDL file. Do not edit it manually. There are
// two cases:
// 1). this is a frozen version file - do not edit this in any case.
// 2). this is a 'current' file. If you make a backwards compatible change to
// the interface (from the latest frozen version), the build system will
// prompt you to update this file with `m <name>-update-api`.
//
// You must not make a backward incompatible change to any AIDL file built
// with the aidl_interface module type with versions property set. The module
// type is used to build AIDL files in a way that they can be used across
// independently updatable components of the system. If a device is shipped
// with such a backward incompatible change, it has a high risk of breaking
// later when a module using the interface is updated, e.g., Mainline modules.
package vendor.eureka.hardware.parts;
@VintfStability
interface IDisplayConfigs {
oneway void writeDisplay(in boolean enable, in vendor.eureka.hardware.parts.DisplaySys type);
boolean readDisplay(in vendor.eureka.hardware.parts.DisplaySys type);
}

View file

@ -1,38 +0,0 @@
// Copyright (C) 2022 Eureka Team
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
///////////////////////////////////////////////////////////////////////////////
// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
///////////////////////////////////////////////////////////////////////////////
// This file is a snapshot of an AIDL file. Do not edit it manually. There are
// two cases:
// 1). this is a frozen version file - do not edit this in any case.
// 2). this is a 'current' file. If you make a backwards compatible change to
// the interface (from the latest frozen version), the build system will
// prompt you to update this file with `m <name>-update-api`.
//
// You must not make a backward incompatible change to any AIDL file built
// with the aidl_interface module type with versions property set. The module
// type is used to build AIDL files in a way that they can be used across
// independently updatable components of the system. If a device is shipped
// with such a backward incompatible change, it has a high risk of breaking
// later when a module using the interface is updated, e.g., Mainline modules.
package vendor.eureka.hardware.parts;
@VintfStability
interface IFlashBrightness {
int readFlashlightstats(in boolean s2mu106);
oneway void setFlashlightEnable(in boolean enable);
oneway void setFlashlightWritable(in int value);
}

View file

@ -1,40 +0,0 @@
// Copyright (C) 2022 Eureka Team
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
///////////////////////////////////////////////////////////////////////////////
// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
///////////////////////////////////////////////////////////////////////////////
// This file is a snapshot of an AIDL file. Do not edit it manually. There are
// two cases:
// 1). this is a frozen version file - do not edit this in any case.
// 2). this is a 'current' file. If you make a backwards compatible change to
// the interface (from the latest frozen version), the build system will
// prompt you to update this file with `m <name>-update-api`.
//
// You must not make a backward incompatible change to any AIDL file built
// with the aidl_interface module type with versions property set. The module
// type is used to build AIDL files in a way that they can be used across
// independently updatable components of the system. If a device is shipped
// with such a backward incompatible change, it has a high risk of breaking
// later when a module using the interface is updated, e.g., Mainline modules.
package vendor.eureka.hardware.parts;
@VintfStability
interface ISmartCharge {
int getLimitCnt();
int getRestartCnt();
oneway void setConfig(in int limit, in int restart);
oneway void start();
oneway void stop();
}

View file

@ -1,40 +0,0 @@
// Copyright (C) 2022 Eureka Team
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
///////////////////////////////////////////////////////////////////////////////
// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
///////////////////////////////////////////////////////////////////////////////
// This file is a snapshot of an AIDL file. Do not edit it manually. There are
// two cases:
// 1). this is a frozen version file - do not edit this in any case.
// 2). this is a 'current' file. If you make a backwards compatible change to
// the interface (from the latest frozen version), the build system will
// prompt you to update this file with `m <name>-update-api`.
//
// You must not make a backward incompatible change to any AIDL file built
// with the aidl_interface module type with versions property set. The module
// type is used to build AIDL files in a way that they can be used across
// independently updatable components of the system. If a device is shipped
// with such a backward incompatible change, it has a high risk of breaking
// later when a module using the interface is updated, e.g., Mainline modules.
package vendor.eureka.hardware.parts;
@VintfStability
interface ISwapOnData {
boolean isMutexLocked();
oneway void removeSwapFile();
oneway void setSwapOff();
oneway void setSwapOn(in vendor.eureka.hardware.parts.IBoolCallback cb);
oneway void makeSwapFile(in int size);
}

View file

@ -1,41 +0,0 @@
// Copyright (C) 2022 Eureka Team
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
///////////////////////////////////////////////////////////////////////////////
// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
///////////////////////////////////////////////////////////////////////////////
// This file is a snapshot of an AIDL file. Do not edit it manually. There are
// two cases:
// 1). this is a frozen version file - do not edit this in any case.
// 2). this is a 'current' file. If you make a backwards compatible change to
// the interface (from the latest frozen version), the build system will
// prompt you to update this file with `m <name>-update-api`.
//
// You must not make a backward incompatible change to any AIDL file built
// with the aidl_interface module type with versions property set. The module
// type is used to build AIDL files in a way that they can be used across
// independently updatable components of the system. If a device is shipped
// with such a backward incompatible change, it has a high risk of breaking
// later when a module using the interface is updated, e.g., Mainline modules.
package vendor.eureka.hardware.parts;
@Backing(type="int") @VintfStability
enum BatterySys {
CAPACITY_MAX = 0,
TEMP = 1,
CAPACITY_CURRENT = 2,
CURRENT = 3,
FASTCHARGE = 4,
CHARGE = 5,
}

View file

@ -1,37 +0,0 @@
// Copyright (C) 2022 Eureka Team
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
///////////////////////////////////////////////////////////////////////////////
// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
///////////////////////////////////////////////////////////////////////////////
// This file is a snapshot of an AIDL file. Do not edit it manually. There are
// two cases:
// 1). this is a frozen version file - do not edit this in any case.
// 2). this is a 'current' file. If you make a backwards compatible change to
// the interface (from the latest frozen version), the build system will
// prompt you to update this file with `m <name>-update-api`.
//
// You must not make a backward incompatible change to any AIDL file built
// with the aidl_interface module type with versions property set. The module
// type is used to build AIDL files in a way that they can be used across
// independently updatable components of the system. If a device is shipped
// with such a backward incompatible change, it has a high risk of breaking
// later when a module using the interface is updated, e.g., Mainline modules.
package vendor.eureka.hardware.parts;
@Backing(type="int") @VintfStability
enum DisplaySys {
DOUBLE_TAP = 0,
GLOVE_MODE = 1,
}

View file

@ -1,37 +0,0 @@
// Copyright (C) 2022 Eureka Team
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
///////////////////////////////////////////////////////////////////////////////
// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
///////////////////////////////////////////////////////////////////////////////
// This file is a snapshot of an AIDL file. Do not edit it manually. There are
// two cases:
// 1). this is a frozen version file - do not edit this in any case.
// 2). this is a 'current' file. If you make a backwards compatible change to
// the interface (from the latest frozen version), the build system will
// prompt you to update this file with `m <name>-update-api`.
//
// You must not make a backward incompatible change to any AIDL file built
// with the aidl_interface module type with versions property set. The module
// type is used to build AIDL files in a way that they can be used across
// independently updatable components of the system. If a device is shipped
// with such a backward incompatible change, it has a high risk of breaking
// later when a module using the interface is updated, e.g., Mainline modules.
package vendor.eureka.hardware.parts;
@VintfStability
interface IBatteryStats {
int getBatteryStats(in vendor.eureka.hardware.parts.BatterySys stats);
oneway void setBatteryWritable(in vendor.eureka.hardware.parts.BatterySys stats, in boolean value);
}

View file

@ -1,36 +0,0 @@
// Copyright (C) 2022 Eureka Team
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
///////////////////////////////////////////////////////////////////////////////
// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
///////////////////////////////////////////////////////////////////////////////
// This file is a snapshot of an AIDL file. Do not edit it manually. There are
// two cases:
// 1). this is a frozen version file - do not edit this in any case.
// 2). this is a 'current' file. If you make a backwards compatible change to
// the interface (from the latest frozen version), the build system will
// prompt you to update this file with `m <name>-update-api`.
//
// You must not make a backward incompatible change to any AIDL file built
// with the aidl_interface module type with versions property set. The module
// type is used to build AIDL files in a way that they can be used across
// independently updatable components of the system. If a device is shipped
// with such a backward incompatible change, it has a high risk of breaking
// later when a module using the interface is updated, e.g., Mainline modules.
package vendor.eureka.hardware.parts;
@VintfStability
interface IBoolCallback {
void respondToBool(in boolean result);
}

View file

@ -1,37 +0,0 @@
// Copyright (C) 2022 Eureka Team
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
///////////////////////////////////////////////////////////////////////////////
// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
///////////////////////////////////////////////////////////////////////////////
// This file is a snapshot of an AIDL file. Do not edit it manually. There are
// two cases:
// 1). this is a frozen version file - do not edit this in any case.
// 2). this is a 'current' file. If you make a backwards compatible change to
// the interface (from the latest frozen version), the build system will
// prompt you to update this file with `m <name>-update-api`.
//
// You must not make a backward incompatible change to any AIDL file built
// with the aidl_interface module type with versions property set. The module
// type is used to build AIDL files in a way that they can be used across
// independently updatable components of the system. If a device is shipped
// with such a backward incompatible change, it has a high risk of breaking
// later when a module using the interface is updated, e.g., Mainline modules.
package vendor.eureka.hardware.parts;
@VintfStability
interface IDisplayConfigs {
oneway void writeDisplay(in boolean enable, in vendor.eureka.hardware.parts.DisplaySys type);
boolean readDisplay(in vendor.eureka.hardware.parts.DisplaySys type);
}

View file

@ -1,38 +0,0 @@
// Copyright (C) 2022 Eureka Team
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
///////////////////////////////////////////////////////////////////////////////
// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
///////////////////////////////////////////////////////////////////////////////
// This file is a snapshot of an AIDL file. Do not edit it manually. There are
// two cases:
// 1). this is a frozen version file - do not edit this in any case.
// 2). this is a 'current' file. If you make a backwards compatible change to
// the interface (from the latest frozen version), the build system will
// prompt you to update this file with `m <name>-update-api`.
//
// You must not make a backward incompatible change to any AIDL file built
// with the aidl_interface module type with versions property set. The module
// type is used to build AIDL files in a way that they can be used across
// independently updatable components of the system. If a device is shipped
// with such a backward incompatible change, it has a high risk of breaking
// later when a module using the interface is updated, e.g., Mainline modules.
package vendor.eureka.hardware.parts;
@VintfStability
interface IFlashBrightness {
int readFlashlightstats(in boolean s2mu106);
oneway void setFlashlightEnable(in boolean enable);
oneway void setFlashlightWritable(in int value);
}

View file

@ -1,40 +0,0 @@
// Copyright (C) 2022 Eureka Team
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
///////////////////////////////////////////////////////////////////////////////
// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
///////////////////////////////////////////////////////////////////////////////
// This file is a snapshot of an AIDL file. Do not edit it manually. There are
// two cases:
// 1). this is a frozen version file - do not edit this in any case.
// 2). this is a 'current' file. If you make a backwards compatible change to
// the interface (from the latest frozen version), the build system will
// prompt you to update this file with `m <name>-update-api`.
//
// You must not make a backward incompatible change to any AIDL file built
// with the aidl_interface module type with versions property set. The module
// type is used to build AIDL files in a way that they can be used across
// independently updatable components of the system. If a device is shipped
// with such a backward incompatible change, it has a high risk of breaking
// later when a module using the interface is updated, e.g., Mainline modules.
package vendor.eureka.hardware.parts;
@VintfStability
interface ISmartCharge {
int getLimitCnt();
int getRestartCnt();
oneway void setConfig(in int limit, in int restart);
oneway void start();
oneway void stop();
}

View file

@ -1,40 +0,0 @@
// Copyright (C) 2022 Eureka Team
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
///////////////////////////////////////////////////////////////////////////////
// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
///////////////////////////////////////////////////////////////////////////////
// This file is a snapshot of an AIDL file. Do not edit it manually. There are
// two cases:
// 1). this is a frozen version file - do not edit this in any case.
// 2). this is a 'current' file. If you make a backwards compatible change to
// the interface (from the latest frozen version), the build system will
// prompt you to update this file with `m <name>-update-api`.
//
// You must not make a backward incompatible change to any AIDL file built
// with the aidl_interface module type with versions property set. The module
// type is used to build AIDL files in a way that they can be used across
// independently updatable components of the system. If a device is shipped
// with such a backward incompatible change, it has a high risk of breaking
// later when a module using the interface is updated, e.g., Mainline modules.
package vendor.eureka.hardware.parts;
@VintfStability
interface ISwapOnData {
boolean isMutexLocked();
oneway void removeSwapFile();
oneway void setSwapOff();
oneway void setSwapOn(in vendor.eureka.hardware.parts.IBoolCallback cb);
oneway void makeSwapFile(in int size);
}

View file

@ -1,20 +0,0 @@
cc_binary {
name: "vendor.eureka.hardware.parts-service",
srcs: [
"Battery.cpp",
"FlashLight.cpp",
"Display.cpp",
"Swap.cpp",
"SmartCharge.cpp",
"service.cpp",
],
shared_libs: [
"libbase",
"libbinder_ndk",
"libfileio",
"vendor.eureka.hardware.parts-V1-ndk",
],
header_libs: ["logformat"],
init_rc: ["vendor.eureka.hardware.parts-service.rc"],
vintf_fragments: ["vendor.eureka.hardware.parts.xml"],
}

View file

@ -1,56 +0,0 @@
// Copyright (C) 2021 Eureka Team
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include <unistd.h>
#include "Battery.h"
#include "BatteryConstants.h"
#include <FileIO.h>
namespace aidl::vendor::eureka::hardware::parts {
static inline const char *BatterySysToPath(BatterySys type) {
switch (type) {
case BatterySys::CAPACITY_MAX:
return BATTERY_CAPACITY_MAX;
case BatterySys::TEMP:
return BATTERY_TEMP;
case BatterySys::CAPACITY_CURRENT:
return BATTERY_CAPACITY_CURRENT;
case BatterySys::CURRENT:
return BATTERY_CURRENT;
case BatterySys::FASTCHARGE:
return BATTERY_FASTCHARGE;
case BatterySys::CHARGE:
return BATTERY_CHARGE;
default:
return "";
}
}
// Methods from ::android::hardware::battery::V1_0::IBattery follow.
::ndk::ScopedAStatus BatteryStats::getBatteryStats(BatterySys stats,
int32_t *_aidl_return) {
*_aidl_return = FileIO::readint(BatterySysToPath(stats));
return ::ndk::ScopedAStatus::ok();
}
::ndk::ScopedAStatus BatteryStats::setBatteryWritable(BatterySys stats,
bool value) {
FileIO::writeline(BatterySysToPath(stats), value ? 1 : 0);
return ::ndk::ScopedAStatus::ok();
}
} // namespace aidl::vendor::eureka::hardware::parts

View file

@ -1,32 +0,0 @@
// Copyright (C) 2021 Eureka Team
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#pragma once
#include <aidl/vendor/eureka/hardware/parts/BnBatteryStats.h>
#define ANDROID_SYSTEM_UID 1000
#define ANDROID_ROOT_UID 0
namespace aidl::vendor::eureka::hardware::parts {
struct BatteryStats : public BnBatteryStats {
// Methods from ::aidl::::vendor::eureka::hardware::parts::IBatteryStats
// follow.
::ndk::ScopedAStatus getBatteryStats(BatterySys stats,
int32_t *_aidl_return) override;
::ndk::ScopedAStatus setBatteryWritable(BatterySys stats,
bool value) override;
};
} // namespace aidl::vendor::eureka::hardware::parts

View file

@ -1,13 +0,0 @@
#pragma once
constexpr const char *BATTERY_CAPACITY_MAX =
"/sys/devices/platform/battery/power_supply/battery/charge_full";
constexpr const char *BATTERY_TEMP =
"/sys/devices/platform/battery/power_supply/battery/batt_temp";
constexpr const char *BATTERY_CAPACITY_CURRENT =
"/sys/devices/platform/battery/power_supply/battery/capacity";
constexpr const char *BATTERY_CURRENT =
"/sys/devices/platform/battery/power_supply/battery/current_now";
constexpr const char *BATTERY_FASTCHARGE = "/sys/class/sec/switch/afc_disable";
constexpr const char *BATTERY_CHARGE =
"/sys/devices/platform/battery/power_supply/battery/batt_slate_mode";

View file

@ -1,128 +0,0 @@
// Copyright (C) 2021 Eureka Team
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#define LOG_TAG "PartsHAL-Display"
#include "Display.h"
#include <sstream>
#include <string>
#include <FileIO.h>
#include <LogFormat.h>
namespace aidl::vendor::eureka::hardware::parts {
constexpr const char *SEC_TSP_CMD = "/sys/class/sec/tsp/cmd";
constexpr const char *SEC_TSP_CMD_RESULT = "/sys/class/sec/tsp/cmd_result";
static std::string DisplayStrBuilder(bool enable, DisplaySys type) {
std::stringstream builder;
switch (type) {
case DisplaySys::DOUBLE_TAP:
builder << "aot_enable";
break;
case DisplaySys::GLOVE_MODE:
builder << "glove_mode";
break;
};
builder << ",";
builder << enable; // Implicit conversion
return builder.str();
}
enum DisplayResult {
OK,
NOOP,
INVALID,
};
constexpr const char *OK_STR = "OK";
constexpr const char *NOOP_STR = "NOOP";
static DisplayResult parseResult(std::string *result, DisplaySys from, bool enabled) {
std::stringstream ss;
std::string parsed;
auto addEmpty = [](std::string *str) {
if (str->empty())
*str = std::string("(empty)");
};
ss << DisplayStrBuilder(enabled, from);
ss << ":";
if (result->find(ss.str()) == std::string::npos) {
LOG_E("Unexpected: Failed to find built string in result string");
goto error;
}
parsed = result->substr(result->find(ss.str()) + 1);
if (parsed == OK_STR) {
return DisplayResult::OK;
} else if (parsed == NOOP_STR) {
return DisplayResult::NOOP;
}
addEmpty(&parsed);
LOG_E("Unexpected: Failed to parse by matching parsed result string");
LOG_E("Parsed string was %s", parsed.c_str());
error:
LOG_W("Falling back to find");
if (result->find(OK_STR) != std::string::npos)
return DisplayResult::OK;
else if (result->find(NOOP_STR) != std::string::npos)
return DisplayResult::NOOP;
else {
addEmpty(result);
LOG_E("Failed to find result string in result string");
LOG_E("Resulting string was: %s", result->c_str());
return DisplayResult::INVALID;
}
}
::ndk::ScopedAStatus DisplayConfigs::writeDisplay(bool enable,
DisplaySys type) {
FileIO::writeline(SEC_TSP_CMD, DisplayStrBuilder(enable, type));
return ::ndk::ScopedAStatus::ok();
}
::ndk::ScopedAStatus DisplayConfigs::readDisplay(DisplaySys type,
bool *_aidl_return) {
std::string res;
writeDisplay(true, type);
res = FileIO::readline(SEC_TSP_CMD_RESULT);
switch (parseResult(&res, type, true)) {
case DisplayResult::NOOP: {
*_aidl_return = true;
break;
}
case DisplayResult::OK: {
writeDisplay(true, type);
res = FileIO::readline(SEC_TSP_CMD_RESULT);
switch (parseResult(&res, type, true)) {
case DisplayResult::NOOP: {
*_aidl_return = false;
writeDisplay(false, type);
break;
}
case DisplayResult::OK: {
LOG_W("Double enable returns OK: function not implemented.");
return ::ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION);
}
case DisplayResult::INVALID:
return ::ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT);
};
} break;
case DisplayResult::INVALID:
return ::ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT);
};
return ::ndk::ScopedAStatus::ok();
}
} // namespace aidl::vendor::eureka::hardware::parts

View file

@ -1,27 +0,0 @@
// Copyright (C) 2021 Eureka Team
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#pragma once
#include <aidl/vendor/eureka/hardware/parts/BnDisplayConfigs.h>
namespace aidl::vendor::eureka::hardware::parts {
struct DisplayConfigs : public BnDisplayConfigs {
// Methods from ::aidl::vendor::eureka::hardware::parts::IDisplayConfigs
// follow.
::ndk::ScopedAStatus writeDisplay(bool enable, DisplaySys type);
::ndk::ScopedAStatus readDisplay(DisplaySys type, bool *_aidl_return);
};
} // namespace aidl::vendor::eureka::hardware::parts

View file

@ -1,44 +0,0 @@
// Copyright (C) 2021 Eureka Team
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include "FlashLight.h"
#include <FileIO.h>
namespace aidl::vendor::eureka::hardware::parts {
constexpr const char *TORCH_ENABLE =
"/sys/class/camera/flash/torch_brightness_lvl_enable";
constexpr const char *TORCH_LVL =
"/sys/class/camera/flash/torch_brightness_lvl";
// Methods from ::android::hardware::parts::V1_0::IFlashLight follow.
::ndk::ScopedAStatus FlashBrightness::setFlashlightEnable(bool enable) {
FileIO::writeline(TORCH_ENABLE, enable ? 1 : 0);
return ::ndk::ScopedAStatus::ok();
}
::ndk::ScopedAStatus FlashBrightness::setFlashlightWritable(int32_t value) {
FileIO::writeline(TORCH_LVL, value);
return ::ndk::ScopedAStatus::ok();
}
::ndk::ScopedAStatus
FlashBrightness::readFlashlightstats(bool s2mu106, int32_t *_aidl_return) {
*_aidl_return =
s2mu106 ? FileIO::readint(TORCH_LVL) / 21 : FileIO::readint(TORCH_LVL);
return ::ndk::ScopedAStatus::ok();
}
} // namespace aidl::vendor::eureka::hardware::parts

View file

@ -1,28 +0,0 @@
// Copyright (C) 2021 Eureka Team
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#pragma once
#include <aidl/vendor/eureka/hardware/parts/BnFlashBrightness.h>
namespace aidl::vendor::eureka::hardware::parts {
struct FlashBrightness : public BnFlashBrightness {
// Methods from ::aidl::vendor::eureka::hardware::parts::IFlashBrightness
// follow.
::ndk::ScopedAStatus setFlashlightEnable(bool enable);
::ndk::ScopedAStatus setFlashlightWritable(int32_t value);
::ndk::ScopedAStatus readFlashlightstats(bool s2mu106, int32_t *_aidl_return);
};
} // namespace aidl::vendor::eureka::hardware::parts

View file

@ -1,84 +0,0 @@
// Copyright (C) 2021 Eureka Team
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include "SmartCharge.h"
#include "BatteryConstants.h"
#include <FileIO.h>
#include <chrono>
namespace aidl::vendor::eureka::hardware::parts {
void SmartCharge::battery_monitor(void) {
while (kShouldRun) {
auto batt = FileIO::readint(BATTERY_CAPACITY_CURRENT);
if (batt >= limit) {
if (kTookAction)
goto sleep;
FileIO::writeline(BATTERY_CHARGE, 1);
kTookAction = true;
limit_stat += 1;
} else if (batt <= restart) {
if (kTookAction)
goto sleep;
FileIO::writeline(BATTERY_CHARGE, 0);
kTookAction = true;
restart_stat += 1;
} else {
if (!kTookAction)
goto sleep;
kTookAction = false;
}
sleep:
std::this_thread::sleep_for(std::chrono::seconds(5));
}
}
::ndk::ScopedAStatus SmartCharge::start(void) {
if (limit == 0 || restart == 0)
return ::ndk::ScopedAStatus::fromExceptionCodeWithMessage(
EX_ILLEGAL_ARGUMENT, "Start called without configuring.");
kShouldRun = true;
monitor_th = new std::thread([this] { battery_monitor(); });
return ::ndk::ScopedAStatus::ok();
}
::ndk::ScopedAStatus SmartCharge::stop(void) {
kShouldRun = false;
if (monitor_th != nullptr) {
monitor_th = nullptr;
}
FileIO::writeline(BATTERY_CHARGE, 0);
return ::ndk::ScopedAStatus::ok();
}
::ndk::ScopedAStatus SmartCharge::setConfig(int32_t limit_user,
int32_t restart_user) {
limit = limit_user;
restart = restart_user;
return ::ndk::ScopedAStatus::ok();
}
::ndk::ScopedAStatus SmartCharge::getLimitCnt(int32_t *_aidl_return) {
*_aidl_return = limit_stat;
return ::ndk::ScopedAStatus::ok();
}
::ndk::ScopedAStatus SmartCharge::getRestartCnt(int32_t *_aidl_return) {
*_aidl_return = restart_stat;
return ::ndk::ScopedAStatus::ok();
}
} // namespace aidl::vendor::eureka::hardware::parts

View file

@ -1,42 +0,0 @@
// Copyright (C) 2021 Eureka Team
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#pragma once
#include <aidl/vendor/eureka/hardware/parts/BnSmartCharge.h>
#include <thread>
namespace aidl::vendor::eureka::hardware::parts {
struct SmartCharge : public BnSmartCharge {
public:
// Methods from ::aidl::vendor::eureka::hardware::parts::ISmartCharge
// follow.
::ndk::ScopedAStatus start(void);
::ndk::ScopedAStatus stop(void);
::ndk::ScopedAStatus setConfig(int32_t limit, int32_t restart);
::ndk::ScopedAStatus getLimitCnt(int32_t *_aidl_return);
::ndk::ScopedAStatus getRestartCnt(int32_t *_aidl_return);
private:
int limit;
int restart;
int limit_stat;
int restart_stat;
bool kShouldRun;
bool kTookAction;
std::thread *monitor_th;
void battery_monitor(void);
};
} // namespace aidl::vendor::eureka::hardware::parts

View file

@ -1,184 +0,0 @@
// Copyright (C) 2022 Eureka Team
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include "Swap.h"
#include <cerrno>
#include <cstdio>
#include <cstring>
#include <fcntl.h>
#include <fstream>
#include <iostream>
#include <mutex>
#include <sys/stat.h>
#include <sys/swap.h>
#include <sys/types.h>
#include <thread>
#include <unistd.h>
#include <vector>
namespace {
/* XXX This needs to be obtained from kernel headers. See b/9336527 */
struct linux_swap_header {
char bootbits[1024]; /* Space for disklabel etc. */
u_int32_t version;
u_int32_t last_page;
u_int32_t nr_badpages;
unsigned char sws_uuid[16];
unsigned char sws_volume[16];
u_int32_t padding[117];
u_int32_t badpages[1];
};
void mkfile(int filesize, const char *path) {
std::vector<char> empty(1024, 0);
std::ofstream ofs(std::string(path), std::ios::binary | std::ios::out);
for (int i = 0; i < 1024 * filesize; i++) {
ofs.write(empty.data(), empty.size());
}
}
#define MAGIC_SWAP_HEADER "SWAPSPACE2"
#define MAGIC_SWAP_HEADER_LEN 10
#define MIN_PAGES 10
int mkswap(const char *filename) {
int err = 0;
int fd;
ssize_t len;
off_t swap_size;
int pagesize;
struct linux_swap_header sw_hdr;
fd = open(filename, O_WRONLY | O_CLOEXEC);
if (fd < 0) {
err = errno;
return err;
}
pagesize = getpagesize();
/* Determine the length of the swap file */
swap_size = lseek(fd, 0, SEEK_END);
if (swap_size < MIN_PAGES * pagesize) {
err = -ENOSPC;
goto err;
}
if (lseek(fd, 0, SEEK_SET)) {
err = errno;
goto err;
}
memset(&sw_hdr, 0, sizeof(sw_hdr));
sw_hdr.version = 1;
sw_hdr.last_page = (swap_size / pagesize) - 1;
len = write(fd, &sw_hdr, sizeof(sw_hdr));
if (len != sizeof(sw_hdr)) {
err = errno;
goto err;
}
/* Write the magic header */
if (lseek(fd, pagesize - MAGIC_SWAP_HEADER_LEN, SEEK_SET) < 0) {
err = errno;
goto err;
}
len = write(fd, MAGIC_SWAP_HEADER, MAGIC_SWAP_HEADER_LEN);
if (len != MAGIC_SWAP_HEADER_LEN) {
err = errno;
goto err;
}
if (fsync(fd) < 0) {
err = errno;
goto err;
}
err:
close(fd);
return err;
}
} // namespace
constexpr const char *SWAP_PATH = "/data/swap/swapfile";
namespace aidl::vendor::eureka::hardware::parts {
static std::mutex thread_lock;
static inline bool swapfile_exist(void) { return access(SWAP_PATH, R_OK | W_OK) == 0; }
static void makeFile(int32_t mSwapSize) {
const std::lock_guard<std::mutex> lock(thread_lock);
mkfile(mSwapSize * 10, SWAP_PATH);
mkswap(SWAP_PATH);
}
::ndk::ScopedAStatus SwapOnData::makeSwapFile(int32_t size) {
if (swapfile_exist())
return ::ndk::ScopedAStatus::ok();
std::thread makefile_thread(makeFile, size);
makefile_thread.detach();
return ::ndk::ScopedAStatus::ok();
}
static void rmswap(void) {
const std::lock_guard<std::mutex> lock(thread_lock);
std::remove(SWAP_PATH);
}
::ndk::ScopedAStatus SwapOnData::removeSwapFile(void) {
if (!swapfile_exist())
return ::ndk::ScopedAStatus::ok();
std::thread rmswap_thread(rmswap);
rmswap_thread.detach();
return ::ndk::ScopedAStatus::ok();
}
static void swapon_func(cb_t cb) {
const std::lock_guard<std::mutex> lock(thread_lock);
int res =
swapon(SWAP_PATH, (10 << SWAP_FLAG_PRIO_SHIFT) & SWAP_FLAG_PRIO_MASK);
if (cb != nullptr)
cb->respondToBool(res == 0);
}
::ndk::ScopedAStatus SwapOnData::setSwapOn(cb_t cb) {
if (!swapfile_exist())
return ::ndk::ScopedAStatus::ok();
std::thread swapon_thread(swapon_func, cb);
swapon_thread.detach();
return ::ndk::ScopedAStatus::ok();
}
static void swapoff_func(void) {
const std::lock_guard<std::mutex> lock(thread_lock);
swapoff(SWAP_PATH);
}
::ndk::ScopedAStatus SwapOnData::setSwapOff() {
if (!swapfile_exist())
return ::ndk::ScopedAStatus::ok();
std::thread swapoff_thread(swapoff_func);
swapoff_thread.detach();
return ::ndk::ScopedAStatus::ok();
}
::ndk::ScopedAStatus SwapOnData::isMutexLocked(bool *_aidl_return) {
if (thread_lock.try_lock()) {
thread_lock.unlock();
*_aidl_return = false;
} else {
*_aidl_return = true;
}
return ::ndk::ScopedAStatus::ok();
}
} // namespace aidl::vendor::eureka::hardware::parts

View file

@ -1,32 +0,0 @@
// Copyright (C) 2021 Eureka Team
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#pragma once
#include <aidl/vendor/eureka/hardware/parts/BnSwapOnData.h>
namespace aidl::vendor::eureka::hardware::parts {
using cb_t = const std::shared_ptr<IBoolCallback> &;
struct SwapOnData : public BnSwapOnData {
// Methods from ::aidl::vendor::eureka::hardware::parts::ISwapOnData
// follow.
::ndk::ScopedAStatus makeSwapFile(int32_t size);
::ndk::ScopedAStatus setSwapOn(cb_t cb);
::ndk::ScopedAStatus removeSwapFile(void);
::ndk::ScopedAStatus setSwapOff(void);
::ndk::ScopedAStatus isMutexLocked(bool *_aidl_return);
};
} // namespace aidl::vendor::eureka::hardware::parts

View file

@ -1,50 +0,0 @@
// Copyright (C) 2021 Eureka Team
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include <android-base/logging.h>
#include <android/binder_manager.h>
#include <android/binder_process.h>
#include "Battery.h"
#include "Display.h"
#include "FlashLight.h"
#include "SmartCharge.h"
#include "Swap.h"
using ::aidl::vendor::eureka::hardware::parts::BatteryStats;
using ::aidl::vendor::eureka::hardware::parts::DisplayConfigs;
using ::aidl::vendor::eureka::hardware::parts::FlashBrightness;
using ::aidl::vendor::eureka::hardware::parts::SmartCharge;
using ::aidl::vendor::eureka::hardware::parts::SwapOnData;
template <class C> static void registerAsService(std::shared_ptr<C> service) {
const std::string instance = std::string() + C::descriptor + "/default";
binder_status_t status =
AServiceManager_addService(service->asBinder().get(), instance.c_str());
CHECK(status == STATUS_OK);
LOG(INFO) << "Register done for " << C::descriptor;
}
int main() {
ABinderProcess_setThreadPoolMaxThreadCount(3);
registerAsService(ndk::SharedRefBase::make<BatteryStats>());
registerAsService(ndk::SharedRefBase::make<DisplayConfigs>());
registerAsService(ndk::SharedRefBase::make<FlashBrightness>());
registerAsService(ndk::SharedRefBase::make<SmartCharge>());
registerAsService(ndk::SharedRefBase::make<SwapOnData>());
ABinderProcess_joinThreadPool();
return -1; // should never get here
}

View file

@ -1,7 +0,0 @@
service parts-hal-aidl /system/bin/vendor.eureka.hardware.parts-service
class hal
user root
group root
on post-fs-data
mkdir /data/swap 0755 root root encryption=None

View file

@ -1,10 +0,0 @@
<manifest version="1.0" type="framework">
<hal format="aidl">
<name>vendor.eureka.hardware.parts</name>
<fqname>IBatteryStats/default</fqname>
<fqname>IDisplayConfigs/default</fqname>
<fqname>IFlashBrightness/default</fqname>
<fqname>ISwapOnData/default</fqname>
<fqname>ISmartCharge/default</fqname>
</hal>
</manifest>

View file

@ -1,26 +0,0 @@
// Copyright (C) 2022 Eureka Team
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package vendor.eureka.hardware.parts;
@Backing(type="int")
@VintfStability
enum BatterySys {
CAPACITY_MAX,
TEMP,
CAPACITY_CURRENT,
CURRENT,
FASTCHARGE,
CHARGE,
}

View file

@ -1,22 +0,0 @@
// Copyright (C) 2022 Eureka Team
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package vendor.eureka.hardware.parts;
@Backing(type="int")
@VintfStability
enum DisplaySys {
DOUBLE_TAP,
GLOVE_MODE,
}

View file

@ -1,24 +0,0 @@
// Copyright (C) 2022 Eureka Team
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package vendor.eureka.hardware.parts;
import vendor.eureka.hardware.parts.BatterySys;
@VintfStability
interface IBatteryStats {
int getBatteryStats(in BatterySys stats);
oneway void setBatteryWritable(in BatterySys stats, in boolean value);
}

View file

@ -1,20 +0,0 @@
// Copyright (C) 2022 Eureka Team
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package vendor.eureka.hardware.parts;
@VintfStability
interface IBoolCallback {
void respondToBool(in boolean result);
}

View file

@ -1,24 +0,0 @@
// Copyright (C) 2022 Eureka Team
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package vendor.eureka.hardware.parts;
import vendor.eureka.hardware.parts.DisplaySys;
@VintfStability
interface IDisplayConfigs {
oneway void writeDisplay(in boolean enable, in DisplaySys type);
boolean readDisplay(in DisplaySys type);
}

View file

@ -1,24 +0,0 @@
// Copyright (C) 2022 Eureka Team
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package vendor.eureka.hardware.parts;
@VintfStability
interface IFlashBrightness {
int readFlashlightstats(in boolean s2mu106);
oneway void setFlashlightEnable(in boolean enable);
oneway void setFlashlightWritable(in int value);
}

View file

@ -1,28 +0,0 @@
// Copyright (C) 2022 Eureka Team
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package vendor.eureka.hardware.parts;
@VintfStability
interface ISmartCharge {
int getLimitCnt();
int getRestartCnt();
oneway void setConfig(in int limit, in int restart);
oneway void start();
oneway void stop();
}

View file

@ -1,31 +0,0 @@
// Copyright (C) 2022 Eureka Team
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package vendor.eureka.hardware.parts;
import vendor.eureka.hardware.parts.IBoolCallback;
@VintfStability
interface ISwapOnData {
boolean isMutexLocked();
oneway void removeSwapFile();
oneway void setSwapOff();
oneway void setSwapOn(in IBoolCallback cb);
oneway void makeSwapFile(in int size);
}