-
Notifications
You must be signed in to change notification settings - Fork 32
prevent using jvm initializer in android and address violation of retrieving unsettable device id #67
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
Merged
wenxi-zeng
merged 22 commits into
main
from
wenxi/prevent-using-jvm-initializer-in-android
Jan 11, 2022
Merged
prevent using jvm initializer in android and address violation of retrieving unsettable device id #67
Changes from 18 commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
fa4b96f
add check on jvm initializer
wenxi-zeng 57f939c
add unit tests
wenxi-zeng ed99882
add note to analytics constructors
wenxi-zeng 1715b3e
fix flasky test
wenxi-zeng fb932b9
update sovran dependencies and get rid jitpack
wenxi-zeng cbfbfb3
fix snapshot artifacts dependency issue
wenxi-zeng a479002
prepare snapshot 1.4.2
wenxi-zeng 64df5df
add cancel previous to github action
wenxi-zeng 4d7d5d7
update release token
wenxi-zeng a593116
address violation of retrieving unsettable device id
wenxi-zeng d1af75d
remove redundant code
wenxi-zeng d4c5227
add more info about drm api
wenxi-zeng adb9157
get rid of android id and serial number
wenxi-zeng 39886cd
remove redundant code
wenxi-zeng 60b229e
fix test case
wenxi-zeng fa6cb4a
Merge branch 'main' of https://github.com/segmentio/analytics-kotlin …
wenxi-zeng f7a3d7e
fix test case
wenxi-zeng 5f9e871
add debug output
wenxi-zeng b5d4eef
use junit assert throw pattern
wenxi-zeng de827c5
try to fix flaky test
wenxi-zeng 7c82c5d
Revert "try to fix flaky test"
wenxi-zeng 2adafea
try to fix flaky test again
wenxi-zeng File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
android/src/test/java/com/segment/analytics/kotlin/android/AndroidAnalyticsKtTest.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package com.segment.analytics.kotlin.android | ||
|
||
import org.junit.jupiter.api.Assertions.* | ||
|
||
import org.junit.jupiter.api.Test | ||
|
||
internal class AndroidAnalyticsKtTest { | ||
@Test | ||
fun `jvm initializer in android platform should failed`() { | ||
try { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i think the new junit has a way to expect exceptions instead of doing this pattern. if u wanna try that There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. let me try that |
||
com.segment.analytics.kotlin.core.Analytics("123") { | ||
application = "Test" | ||
} | ||
fail() | ||
} | ||
catch(e: Exception){ | ||
assertEquals(e.message?.contains("Android"), true) | ||
} | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
core/src/main/java/com/segment/analytics/kotlin/core/Constants.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
package com.segment.analytics.kotlin.core | ||
|
||
object Constants { | ||
const val LIBRARY_VERSION = "1.4.1" | ||
const val LIBRARY_VERSION = "1.4.2" | ||
const val DEFAULT_API_HOST = "api.segment.io/v1" | ||
const val DEFAULT_CDN_HOST = "cdn-settings.segment.com/v1" | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
given that we support api 16+ we should have some fallback logic here
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.
good point. the
getDeviceId
method does a null check and returns random uuid as fallback.