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
Conversation
apidoc/Titanium/UI/Window.yml
Outdated
summary: true to enable sustained performance mode | ||
type: Boolean | ||
since: "6.1.0" | ||
platforms: [android] |
There was a problem hiding this comment.
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)); |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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");
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright I'll see 👍
There was a problem hiding this comment.
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 :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@hansemannn nice catch! :)
apidoc/Titanium/UI/Window.yml
Outdated
@@ -800,6 +815,14 @@ properties: | |||
since: "3.1.3" | |||
platforms: [iphone,ipad] | |||
|
|||
- name: sustainedPerformanceMode | |||
summary: Maintain a sustainable level of performance |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing "." at the end.
apidoc/Titanium/UI/Window.yml
Outdated
- 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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Break into multiple lines
1c004d7
to
f0252eb
Compare
e9340a4
to
69ac9ba
Compare
Also, I suggest adding Footnote: adding Android docs: Consistent Performance for future reference. |
apidoc/Titanium/UI/Window.yml
Outdated
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 |
There was a problem hiding this comment.
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
96bf90d
to
8a06c59
Compare
apidoc/Titanium/UI/Window.yml
Outdated
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] |
There was a problem hiding this comment.
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!
Continued by #9582 |
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