Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cherry pick PR #3301: Remove compile-time config for extended IFA #3303

Merged
merged 3 commits into from
May 20, 2024
Merged
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
3 changes: 0 additions & 3 deletions cobalt/h5vcc/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@ config("h5vcc_external_config") {
if (enable_account_manager) {
defines += [ "COBALT_ENABLE_ACCOUNT_MANAGER" ]
}
if (enable_extended_ifa_in_h5vcc) {
defines += [ "COBALT_ENABLE_EXTENDED_IFA" ]
}
}

static_library("h5vcc") {
Expand Down
15 changes: 4 additions & 11 deletions cobalt/h5vcc/h5vcc_system.cc
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ H5vccSystem::H5vccSystem(
task_runner_(base::ThreadTaskRunnerHandle::Get()),
ifa_extension_(static_cast<const StarboardExtensionIfaApi*>(
SbSystemGetExtension(kStarboardExtensionIfaName))) {
#if defined(COBALT_ENABLE_EXTENDED_IFA)
if (ifa_extension_ && ifa_extension_->version >= 2) {
ifa_extension_->RegisterTrackingAuthorizationCallback(
this, [](void* context) {
Expand All @@ -53,15 +52,12 @@ H5vccSystem::H5vccSystem(
}
});
}
#endif // defined(COBALT_ENABLE_EXTENDED_IFA)
}

H5vccSystem::~H5vccSystem() {
#if defined(COBALT_ENABLE_EXTENDED_IFA)
if (ifa_extension_ && ifa_extension_->version >= 2) {
ifa_extension_->UnregisterTrackingAuthorizationCallback();
}
#endif // defined(COBALT_ENABLE_EXTENDED_IFA)
}

bool H5vccSystem::are_keys_reversed() const {
Expand Down Expand Up @@ -132,21 +128,20 @@ bool H5vccSystem::limit_ad_tracking() const {
return result;
}

#if defined(COBALT_ENABLE_EXTENDED_IFA)

std::string H5vccSystem::tracking_authorization_status() const {
std::string result = "UNKNOWN";
char property[kSystemPropertyMaxLength] = {0};
if (ifa_extension_ && ifa_extension_->version >= 2) {
std::string result = "UNKNOWN";
char property[kSystemPropertyMaxLength] = {0};
if (!ifa_extension_->GetTrackingAuthorizationStatus(
property, SB_ARRAY_SIZE_INT(property))) {
DLOG(FATAL)
<< "Failed to get TrackingAuthorizationStatus from IFA extension.";
} else {
result = property;
}
return result;
}
return result;
return "NOT_SUPPORTED";
}

void H5vccSystem::ReceiveTrackingAuthorizationComplete() {
Expand Down Expand Up @@ -194,8 +189,6 @@ script::HandlePromiseVoid H5vccSystem::RequestTrackingAuthorization(
return promise;
}

#endif // defined(COBALT_ENABLE_EXTENDED_IFA)

std::string H5vccSystem::region() const {
// No region information.
return "";
Expand Down
4 changes: 0 additions & 4 deletions cobalt/h5vcc/h5vcc_system.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,9 @@ class H5vccSystem : public script::Wrappable {
std::string version() const;
std::string advertising_id() const;
bool limit_ad_tracking() const;
#if defined(COBALT_ENABLE_EXTENDED_IFA)
std::string tracking_authorization_status() const;
script::HandlePromiseVoid RequestTrackingAuthorization(
script::EnvironmentSettings* environment_settings);
#endif // defined(COBALT_ENABLE_EXTENDED_IFA)

bool TriggerHelp() const;

Expand All @@ -73,11 +71,9 @@ class H5vccSystem : public script::Wrappable {
#endif
scoped_refptr<base::SingleThreadTaskRunner> const task_runner_;
const StarboardExtensionIfaApi* ifa_extension_;
#if defined(COBALT_ENABLE_EXTENDED_IFA)
void ReceiveTrackingAuthorizationComplete();
std::vector<std::unique_ptr<script::ValuePromiseVoid::Reference>>
request_tracking_authorization_promises_;
#endif // defined(COBALT_ENABLE_EXTENDED_IFA)
DISALLOW_COPY_AND_ASSIGN(H5vccSystem);
};

Expand Down
4 changes: 2 additions & 2 deletions cobalt/h5vcc/h5vcc_system.idl
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ interface H5vccSystem {
readonly attribute DOMString version;
readonly attribute DOMString advertisingId;
readonly attribute boolean limitAdTracking;
[Conditional=COBALT_ENABLE_EXTENDED_IFA] readonly attribute DOMString trackingAuthorizationStatus;
[Conditional=COBALT_ENABLE_EXTENDED_IFA, CallWith=EnvironmentSettings, NewObject] Promise<void> requestTrackingAuthorization();
readonly attribute DOMString trackingAuthorizationStatus;
[CallWith=EnvironmentSettings, NewObject] Promise<void> requestTrackingAuthorization();
boolean triggerHelp();

// enum UserOnExitStrategy
Expand Down
1 change: 0 additions & 1 deletion cobalt/site/docs/reference/starboard/gn-configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ Book: /youtube/cobalt/_book.yaml
| **`cobalt_v8_emit_builtins_as_inline_asm`**<br><br> Some compiler can not compile with raw assembly(.S files) and v8 converts asm to inline assembly for these platforms.<br><br>The default value is `false`. |
| **`default_renderer_options_dependency`**<br><br> Override this value to adjust the default rasterizer setting for your platform.<br><br>The default value is `"//cobalt/renderer:default_options"`. |
| **`enable_account_manager`**<br><br> Set to true to enable H5vccAccountManager.<br><br>The default value is `false`. |
| **`enable_extended_ifa_in_h5vcc`**<br><br> Set to true to enable extended IFA functionality in H5vccSystem.<br><br>The default value is `false`. |
| **`enable_in_app_dial`**<br><br> Enables or disables the DIAL server that runs inside Cobalt. Note: Only enable if there's no system-wide DIAL support.<br><br>The default value is `false`. |
| **`executable_configs`**<br><br> Target-specific configurations for executable targets.<br><br>The default value is `[]`. |
| **`final_executable_type`**<br><br> The target type for executable targets. Allows changing the target type on platforms where the native code may require an additional packaging step (ex. Android).<br><br>The default value is `"executable"`. |
Expand Down
3 changes: 0 additions & 3 deletions starboard/build/config/base_configuration.gni
Original file line number Diff line number Diff line change
Expand Up @@ -175,9 +175,6 @@ declare_args() {
# all unused symbols and nplb fails to link.
# TODO: b/297808555 Remove this flag after nplb is fixed
sb_has_unused_symbol_issue = false

# Set to true to enable extended IFA functionality in H5vccSystem.
enable_extended_ifa_in_h5vcc = false
}

if (current_toolchain == starboard_toolchain &&
Expand Down
1 change: 1 addition & 0 deletions starboard/extension/ifa.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ typedef struct StarboardExtensionIfaApi {

// Returns the the user's authorization status for using IFA in this app.
// Valid strings that can be returned are:
// * NOT_SUPPORTED - if this platform doesn't support this extension
// * UNKNOWN - if the system isn't able to determine a status
// * NOT_DETERMINED - the user hasn't made a decision yet
// * RESTRICTED - the system doesn't allow the user a choice
Expand Down
Loading