Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
Trac
Trac
  • Project overview
    • Project overview
    • Details
    • Activity
  • Issues 246
    • Issues 246
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Operations
    • Operations
    • Metrics
    • Incidents
  • Analytics
    • Analytics
    • Value Stream
  • Wiki
    • Wiki
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Create a new issue
  • Issue Boards

GitLab is used only for code review, issue tracking and project management. Canonical locations for source code are still https://gitweb.torproject.org/ https://git.torproject.org/ and git-rw.torproject.org.

  • Legacy
  • TracTrac
  • Issues
  • #28685

Closed (moved)
Open
Opened Dec 02, 2018 by Matthew Finkel@sysrqb

Tor Browser for Android needs a more dynamic Build ID

Currently, the build id only changes when the Firefox version changes and when the copyright year changes. Unfortunately, when building the APK, Mozilla expect the build id changes between every build. They use the build id and derive the Android version code (version number) from this. Unfortunately, they only use part of the buildid and they discard lower bits. This doesn't fit well with the current get-moz-build-date script because:

  1. if the firefox build date and copyright year remain the same, then the build id remains the same
  2. if the patch version increases (such as 60.3.0 to 60.3.1), then the Android version code doesn't change (due to discarded lower bits)

I think we can solve 1. by incorporating the tor browser version number into the calculation. Solving 2. may require multiplying by at least 3600 (therefore offsets the division by 60*60), i think. https://gitweb.torproject.org/tor-browser.git/tree/python/mozbuild/mozbuild/android_version_code.py?h=tor-browser-60.3.0esr-8.5-1#n33

$ perl get-moz-build-date 2018 60.3.0
export MOZ_BUILD_DATE=20180204040101

$ python python/mozbuild/mozbuild/android_version_code.py --verbose --with-android-cpu-arch armeabi-v7a --with-android-min-sdk-version 16 --with-android-max-sdk-version 26 20180204040101
2015539361


$ perl get-moz-build-date 2018 60.3.1
export MOZ_BUILD_DATE=20180204040201

$ python python/mozbuild/mozbuild/android_version_code.py --verbose --with-android-cpu-arch armeabi-v7a --with-android-min-sdk-version 16 --with-android-max-sdk-version 26 20180204040201
2015539361


$ perl get-moz-build-date 2018 60.4.0
export MOZ_BUILD_DATE=20180204050101

$ python python/mozbuild/mozbuild/android_version_code.py --verbose --with-android-cpu-arch armeabi-v7a --with-android-min-sdk-version 16 --with-android-max-sdk-version 26 20180204050101
2015539369

Notice the android version code is the same for 60.3.0 and 60.3.1.

Currently, the script with the current Tor Browser Build ID is:

import math
import time
                                                                                                                                                                                                                   
fmt = '%Y%m%d%H%M%S'
buildid = "20180204040101"
V1_CUTOFF = 20150801000000

build = time.strptime(str(buildid), fmt)
cutoff = time.strptime(str(V1_CUTOFF), fmt)

base = int(math.floor((time.mktime(build) - time.mktime(cutoff)) / (60.0 * 60.0)))
version = 0b1111000001000000000000000000000
version |= base << 3
version |= 1 << 0
print(version)

Something else I noticed is this current scheme only provides 8 android version codes between 60.3.0 (2015539361) and 60.4.0 (2015539369). We probably want more than that - but this may be accomplished when adjusting the other bits.

To upload designs, you'll need to enable LFS and have admin enable hashed storage. More information
Assignee
Assign to
None
Milestone
None
Assign milestone
Time tracking
None
Due date
None
Reference: legacy/trac#28685