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

[TIMOB-23802] Android: expose sustainedPerformancemode for future development #8709

Closed
wants to merge 8 commits into from

Conversation

frankieandone
Copy link
Contributor

Added property and updated docs for future reference. Feature is currently only available on Android 7 Nexus 6P + API docs/dev is seems premature, experimental and subject to changes. See Android docs for info

JIRA: https://jira.appcelerator.org/browse/TIMOB-23802

summary: true to enable sustained performance mode
type: Boolean
since: "6.1.0"
platforms: [android]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You don't need the custom getter and setter, they are auto-generated in the docs

@@ -164,6 +166,10 @@ protected void handleOpen(KrollDict options)
topActivity.startActivity(intent);
}
}

if (options.containsKey(TiC.PROPERTY_SUSTAINED_PERFORMANCE_MODE)) {
setPropertyAndFire(TiC.PROPERTY_SUSTAINED_PERFORMANCE_MODE, options.getBoolean(TiC.PROPERTY_SUSTAINED_PERFORMANCE_MODE));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So where is the property used on the native side? I only see the proxy-methods so far. WiP?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was afraid of adding it currently because that feature is only available in Android API 24 and not 23. We only currently support 23. But if I were to add it, it would be in the thread state methods in TiBaseActivity

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just encapsulate it, something like:

if (Build.VERSION.SDK_INT == 24 && isSustainedPerformanceModeSupported()) {
    ...
} else {
    Log.w(TAG, "sustainedPerformanceMode is not supported on this version of Android");
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright I'll see 👍

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer >= 24 but yeah :-)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hansemannn nice catch! :)

@@ -800,6 +815,14 @@ properties:
since: "3.1.3"
platforms: [iphone,ipad]

- name: sustainedPerformanceMode
summary: Maintain a sustainable level of performance
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing "." at the end.

- name: sustainedPerformanceMode
summary: Maintain a sustainable level of performance
description: |
Performance can fluctuate dramatically for long-running apps, because the system throttles system-on-chip engines as device components reach their temperature limits. This fluctuation presents a moving target for app developers creating high-performance, long-running apps. Setting this feature to true will set sustained performance mode for the corresponding window. If property is undefined then it defaults to false. IMPORTANT NOTE: feature is only available on supported devices and awaiting for further API development by Google. See [Android docs](https://developer.android.com/about/versions/nougat/android-7.0.html#sustained_performance_api) for further info.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Break into multiple lines

@frankieandone
Copy link
Contributor Author

Also, I suggest adding isSustainedPerformanceModeSupported() to check if device supports feature. See: Android docs: PowerManager.

Footnote: adding Android docs: Consistent Performance for future reference.

Setting this feature to true will set sustained performance mode for the corresponding window. If property is undefined then it defaults to false.

Note: feature is only available on supported devices and functionality is experimental and subject to change in future releases. See [Android docs](https://developer.android.com/about/versions/nougat/android-7.0.html#sustained_performance_api) and [Google VR docs](https://developers.google.com/vr/android/ndk/jni/reference/com/google/vr/ndk/base/AndroidCompat.html#setSustainedPerformanceMode(Activity, boolean)) for further info.
type: Boolean
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The lines are still too long. Example of proper line breaks:

Performance can fluctuate dramatically for long-running apps, because the system throttles 
system-on-chip engines as device components reach their temperature limits. This fluctuation 
presents a moving target for app developers creating high-performance, long-running apps.
     
Setting this feature to true will set sustained performance mode for the corresponding window. 
If the property is undefined it defaults to false.
        
Note: feature is only available on supported devices and functionality is experimental and 
subject to change in future releases. See the [Android docs](https://developer.android.com/about/versions/nougat/android-7.0.html#sustained_performance_api) and [Google VR docs](https://developers.google.com/vr/android/ndk/jni/reference/com/google/vr/ndk/base/AndroidCompat.html#setSustainedPerformanceMode(Activity, boolean)) for further info.

Note that I did not break the last names, since the links cause the length there

subject to change in future releases. See [Android docs](https://developer.android.com/about/versions/nougat/android-7.0.html#sustained_performance_api) and [Google VR docs](https://developers.google.com/vr/android/ndk/jni/reference/com/google/vr/ndk/base/AndroidCompat.html#setSustainedPerformanceMode(Activity, boolean)) for further info.
type: Boolean
since: "6.1.0"
platforms: [android]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add osver: {android: {min: "7.0"}} ? Rest looks cool to me!

@hansemannn hansemannn modified the milestones: 6.1.0, 6.2.0 Jun 5, 2017
@hansemannn hansemannn modified the milestones: 7.0.0, 6.2.0 Aug 15, 2017
@garymathews
Copy link
Contributor

Continued by #9582

@garymathews garymathews closed this Nov 2, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants