xref: /aosp_15_r20/external/golang-protobuf/android/android.go (revision 1c12ee1efe575feb122dbf939ff15148a3b3e8f2)
1// Package android provides android-specific extensions to the upstream module.
2package android
3
4import "google.golang.org/protobuf/internal/detrand"
5
6// DisableRand disables the randomness introduced into JSON and Text encodings.
7// This function is not concurrent-safe and must be called during program init.
8//
9// This does not guarantee long term stability of the JSON/Text encodings, but
10// that isn't necessary in Soong or similar build tools. They are only
11// interested in longer stable periods, as any change in the output may
12// introduce significant extra building during incremental builds. That price
13// is expected when upgrading library versions (and will be paid then even
14// without a format change, as the reader and writer packages will often both
15// change), but is not desired when changing other parts of the executables.
16//
17// See https://github.com/golang/protobuf/issues/1121 for more discussion.
18func DisableRand() {
19	detrand.Disable()
20}
21