more patches from divest

LeOS-U
harvey186 2023-12-19 13:19:06 +01:00
parent bca40cdc11
commit 6acb630f18
23 changed files with 93990 additions and 172470 deletions

View File

@ -14,6 +14,8 @@ git clone https://github.com/ponces/treble_aosp -b android-14.0
git clone https://github.com/ponces/vendor_ponces.git -b android-14.0 vendor/ponces
cp LeOS/patch.sh treble_aosp
set -e
initRepos() {
@ -58,6 +60,9 @@ applyPatches() {
cp LeOS/platform_test_list.mk plattform_testing/build/tasks/tests/
echo
echo "creatings host file"
cp LeOS/hosts system/core/rootdir/etc/
echo "--> Generating makefiles"
cd device/phh/treble
cp treble_aosp/build/aosp.mk device/phh/treble/
@ -91,15 +96,8 @@ buildVanillaVariant() {
lunch leos_arm64_bvS-userdebug
#make installclean
make -j12 RELAX_USES_LIBRARY_CHECK=true systemimage
echo
echo "--> Building treble_a64_bvS"
export WITHOUT_CHECK_API=true
export USE_CCACHE=1
export CCACHE_SIZE=50G
export WITH_SU=true
lunch leos_a64_bvS-userdebug
#make installclean
make -j12 RELAX_USES_LIBRARY_CHECK=true systemimage
echo "--> Building LeOS-U-VNDKLITE-arm64-bvS.img"
cd treble_adapter
@ -107,27 +105,6 @@ buildVanillaVariant() {
mv s.img LeOS-U-VNDKLITE-arm64-bvS.img
sudo rm -rf d tmp
echo "--> Building LeOS-U-VNDKLITE-arm64-bvN"
sudo bash lite-adapterN.sh 64 ../out/target/product/leos_arm64_ab/system.img
mv s.img LeOS-U-VNDKLITE-arm64-bvN.img
sudo rm -rf d tmp
cd ..
echo
echo "--> Building LeOS-U-VNDKLITE-a64-bvS.img"
cd treble_adapter
sudo bash lite-adapterSa64.sh 32 ../out/target/product/leos_a64_ab/system.img
mv s.img LeOS-U-VNDKLITE-a64-bvS.img
sudo rm -rf d tmp
echo "--> Building LeOS-U-VNDKLITE-a64-bvN"
sudo bash lite-adapterNa64.sh 32 ../out/target/product/leos_a64_ab/system.img
mv s.img LeOS-U-VNDKLITE-a64-bvN.img
sudo rm -rf d tmp
cd ..
echo
cd prebuilts/prebuiltapks/foss_nano/
bash update.sh
cd ../../..
@ -140,6 +117,15 @@ buildVanillaVariant() {
lunch leos_arm64_bvN-userdebug
#make installclean
make -j12 RELAX_USES_LIBRARY_CHECK=true systemimage
cp out/target/product/leos_arm64_ab/system.img treble_adapter/LeOS-U-VNDK-arm64_bvN.img
echo "--> Building LeOS-U-VNDKLITE-arm64-bvN"
sudo bash lite-adapterN.sh 64 ../out/target/product/leos_arm64_ab/system.img
mv s.img LeOS-U-VNDKLITE-arm64-bvN.img
sudo rm -rf d tmp
cd ..
echo
echo
echo "--> Building treble_a64_bvN"
export WITHOUT_CHECK_API=true
@ -149,13 +135,38 @@ buildVanillaVariant() {
lunch leos_a64_bvN-userdebug
#make installclean
make -j12 RELAX_USES_LIBRARY_CHECK=true systemimage
cp out/target/product/leos_a64_ab/system.img treble_adapter/LeOS-U-VNDK-a64-bvN.img
echo "--> Building LeOS-U-VNDKLITE-a64-bvN"
sudo bash lite-adapterNa64.sh 32 ../out/target/product/leos_a64_ab/system.img
mv s.img LeOS-U-VNDKLITE-a64-bvN.img
sudo rm -rf d tmp
cd ..
echo
cd prebuilts/prebuiltapks/foss_nano/
bash update.sh
cd ../../..
echo "--> Building treble_a64_bvS"
export WITHOUT_CHECK_API=true
export USE_CCACHE=1
export CCACHE_SIZE=50G
export WITH_SU=true
lunch leos_a64_bvS-userdebug
#make installclean
make -j12 RELAX_USES_LIBRARY_CHECK=true systemimage
echo "--> Building LeOS-U-VNDKLITE-a64-bvS.img"
cd treble_adapter
sudo bash lite-adapterSa64.sh 32 ../out/target/product/leos_a64_ab/system.img
mv s.img LeOS-U-VNDKLITE-a64-bvS.img
sudo rm -rf d tmp
}
generatePackages() {
echo "--> Generating packages"
cp out/target/product/leos_arm64_ab/system.img treble_adapter/LeOS-U-VNDK-arm64_bvN.img
cp out/target/product/leos_a64_ab/system.img treble_adapter/LeOS-U-VNDK-a64-bvN.img
cd treble_adapter
xz -vT0 *.img
cp *.img.xz /media/ich/exSSD2/leos-cloud/LeOS-Files/LeOS-U/$MONTH/

14
LeOS/eOS.xml Normal file
View File

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<manifest>
<remote name="github"
fetch=".."
review="review.lineageos.org" />
<remote name="e-priv" fetch="ssh://git@gitlab.e.foundation:2222" revision="refs/heads/v1-t"/>
<remote name="e" fetch="https://gitlab.e.foundation" revision="refs/heads/v1-t"/>
<project name="e/os/elib" path="packages/apps/elib" remote="e" revision="252b29c4c355ab08b4a2f51f154f2523547bdfe2" upstream="main" dest-branch="main"/>
<project name="e/os/ih8sn" path="external/ih8sn" remote="e" revision="5d2b981d71461a9874bb87021fb05419b2f7d209" upstream="master" dest-branch="master"/>
<project name="e/os/picotts" path="external/svox" remote="e" revision="3e6293ea56b958c5537a2dd8318d3732748dea81" upstream="refs/heads/v1-t" dest-branch="refs/heads/v1-t"/>
</manifest>

262980
LeOS/hosts

File diff suppressed because it is too large Load Diff

19
LeOS/patch.sh Normal file
View File

@ -0,0 +1,19 @@
#!/bin/bash
set -e
patches="$(readlink -f -- $1)"
tree="$2"
for project in $(cd $patches/patches/$tree; echo *); do
p="$(tr _ / <<<$project |sed -e 's;platform/;;g')"
[ "$p" == build ] && p=build/make
[ "$p" == treble/app ] && p=treble_app
[ "$p" == treble/adapter ] && p=treble_adapter
[ "$p" == vendor/hardware/overlay ] && p=vendor/hardware_overlay
pushd $p &>/dev/null
for patch in $patches/patches/$tree/$project/*.patch; do
git am $patch || exit
done
popd &>/dev/null
done

Binary file not shown.

View File

@ -0,0 +1,639 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Tom Marshall <tdm@cyngn.com>
Date: Fri, 17 Jun 2016 16:38:12 -0700
Subject: [PATCH] bionic: Sort and cache hosts file data for fast lookup
The hosts file is normally searched linearly. This is very slow when
the file is large. To mitigate this, read the hosts file and sort the
entries in an in-memory cache. When an address is requested via
gethostbyname or getaddrinfo, binary search the cache.
In case where the cache is not available, return a suitable error code
and fall back to the existing lookup code.
This has been written to behave as much like the existing lookup code as
possible. But note bionic and glibc differ in behavior for some corner
cases. Choose the most standard compliant behavior for these where
possible. Otherwise choose the behavior that seems most reasonable.
RM-290
Change-Id: I3b322883cbc48b0d76a0ce9d149b59faaac1dc58
(cherry picked from commit ed4c3a6bd449a4ed70645071a440ae146f194116)
---
libc/dns/net/getaddrinfo.c | 10 +
libc/dns/net/hosts_cache.c | 520 +++++++++++++++++++++++++++++++++++++
libc/dns/net/hosts_cache.h | 23 ++
libc/dns/net/sethostent.c | 7 +
4 files changed, 560 insertions(+)
create mode 100644 libc/dns/net/hosts_cache.c
create mode 100644 libc/dns/net/hosts_cache.h
diff --git a/libc/dns/net/getaddrinfo.c b/libc/dns/net/getaddrinfo.c
index d0c11d2b0..cc94b21e2 100644
--- a/libc/dns/net/getaddrinfo.c
+++ b/libc/dns/net/getaddrinfo.c
@@ -109,6 +109,8 @@
#include "nsswitch.h"
#include "private/bionic_defs.h"
+#include "hosts_cache.h"
+
typedef union sockaddr_union {
struct sockaddr generic;
struct sockaddr_in in;
@@ -2125,6 +2127,14 @@ _files_getaddrinfo(void *rv, void *cb_data, va_list ap)
name = va_arg(ap, char *);
pai = va_arg(ap, struct addrinfo *);
+ memset(&sentinel, 0, sizeof(sentinel));
+ cur = &sentinel;
+ int gai_error = hc_getaddrinfo(name, NULL, pai, &cur);
+ if (gai_error != EAI_SYSTEM) {
+ *((struct addrinfo **)rv) = sentinel.ai_next;
+ return (gai_error == 0 ? NS_SUCCESS : NS_NOTFOUND);
+ }
+
// fprintf(stderr, "_files_getaddrinfo() name = '%s'\n", name);
memset(&sentinel, 0, sizeof(sentinel));
cur = &sentinel;
diff --git a/libc/dns/net/hosts_cache.c b/libc/dns/net/hosts_cache.c
new file mode 100644
index 000000000..52d29e032
--- /dev/null
+++ b/libc/dns/net/hosts_cache.c
@@ -0,0 +1,520 @@
+/*
+ * Copyright (C) 2016 The CyanogenMod Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <fcntl.h>
+#include <netdb.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+#include <strings.h>
+#include <sys/file.h>
+#include <sys/mman.h>
+#include <sys/socket.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <unistd.h>
+#include <utime.h>
+#include <pthread.h>
+
+#include <netinet/in6.h>
+#include <arpa/inet.h>
+
+#include "hostent.h"
+#include "resolv_private.h"
+
+#define MAX_ADDRLEN (INET6_ADDRSTRLEN - (1 + 5))
+#define MAX_HOSTLEN MAXHOSTNAMELEN
+
+#define ESTIMATED_LINELEN 32
+#define HCFILE_ALLOC_SIZE 256
+
+/*
+ * Host cache entry for hcfile.c_data.
+ * Offsets are into hcfile.h_data.
+ * Strings are *not* terminated by NULL, but by whitespace (isspace) or '#'.
+ * Use hstr* functions with these.
+ */
+struct hcent
+{
+ uint32_t addr;
+ uint32_t name;
+};
+
+/*
+ * Overall host cache file state.
+ */
+struct hcfile
+{
+ int h_fd;
+ struct stat h_st;
+ char *h_data;
+
+ uint32_t c_alloc;
+ uint32_t c_len;
+ struct hcent *c_data;
+};
+static struct hcfile hcfile;
+static pthread_mutex_t hclock = PTHREAD_MUTEX_INITIALIZER;
+
+static size_t hstrlen(const char *s)
+{
+ const char *p = s;
+ while (*p && *p != '#' && !isspace(*p))
+ ++p;
+ return p - s;
+}
+
+static int hstrcmp(const char *a, const char *b)
+{
+ size_t alen = hstrlen(a);
+ size_t blen = hstrlen(b);
+ int res = strncmp(a, b, MIN(alen, blen));
+ if (res == 0)
+ res = alen - blen;
+ return res;
+}
+
+static char *hstrcpy(char *dest, const char *src)
+{
+ size_t len = hstrlen(src);
+ memcpy(dest, src, len);
+ dest[len] = '\0';
+ return dest;
+}
+
+static char *hstrdup(const char *s)
+{
+ size_t len = hstrlen(s);
+ char *dest = (char *)malloc(len + 1);
+ if (!dest)
+ return NULL;
+ memcpy(dest, s, len);
+ dest[len] = '\0';
+ return dest;
+}
+
+static int cmp_hcent_name(const void *a, const void *b)
+{
+ struct hcent *ea = (struct hcent *)a;
+ const char *na = hcfile.h_data + ea->name;
+ struct hcent *eb = (struct hcent *)b;
+ const char *nb = hcfile.h_data + eb->name;
+
+ return hstrcmp(na, nb);
+}
+
+static struct hcent *_hcfindname(const char *name)
+{
+ size_t first, last, mid;
+ struct hcent *cur = NULL;
+ int cmp;
+
+ if (hcfile.c_len == 0)
+ return NULL;
+
+ first = 0;
+ last = hcfile.c_len - 1;
+ mid = (first + last) / 2;
+ while (first <= last) {
+ cur = hcfile.c_data + mid;
+ cmp = hstrcmp(hcfile.h_data + cur->name, name);
+ if (cmp == 0)
+ goto found;
+ if (cmp < 0)
+ first = mid + 1;
+ else {
+ if (mid > 0)
+ last = mid - 1;
+ else
+ return NULL;
+ }
+ mid = (first + last) / 2;
+ }
+ return NULL;
+
+found:
+ while (cur > hcfile.c_data) {
+ struct hcent *prev = cur - 1;
+ cmp = cmp_hcent_name(cur, prev);
+ if (cmp)
+ break;
+ cur = prev;
+ }
+
+ return cur;
+}
+
+/*
+ * Find next name on line, if any.
+ *
+ * Assumes that line is terminated by LF.
+ */
+static const char *_hcnextname(const char *name)
+{
+ while (!isspace(*name)) {
+ if (*name == '#')
+ return NULL;
+ ++name;
+ }
+ while (isspace(*name)) {
+ if (*name == '\n')
+ return NULL;
+ ++name;
+ }
+ if (*name == '#')
+ return NULL;
+ return name;
+}
+
+static int _hcfilemmap(void)
+{
+ struct stat st;
+ int h_fd;
+ char *h_addr;
+ const char *p, *pend;
+ uint32_t c_alloc;
+
+ h_fd = open(_PATH_HOSTS, O_RDONLY);
+ if (h_fd < 0)
+ return -1;
+ if (flock(h_fd, LOCK_EX) != 0) {
+ close(h_fd);
+ return -1;
+ }
+
+ if (hcfile.h_data) {
+ memset(&st, 0, sizeof(st));
+ if (fstat(h_fd, &st) == 0) {
+ if (st.st_size == hcfile.h_st.st_size &&
+ st.st_mtime == hcfile.h_st.st_mtime) {
+ flock(h_fd, LOCK_UN);
+ close(h_fd);
+ return 0;
+ }
+ }
+ free(hcfile.c_data);
+ munmap(hcfile.h_data, hcfile.h_st.st_size);
+ close(hcfile.h_fd);
+ memset(&hcfile, 0, sizeof(struct hcfile));
+ }
+
+ if (fstat(h_fd, &st) != 0) {
+ flock(h_fd, LOCK_UN);
+ close(h_fd);
+ return -1;
+ }
+ h_addr = mmap(NULL, st.st_size, PROT_READ, MAP_SHARED, h_fd, 0);
+ if (h_addr == MAP_FAILED) {
+ flock(h_fd, LOCK_UN);
+ close(h_fd);
+ return -1;
+ }
+
+ hcfile.h_fd = h_fd;
+ hcfile.h_st = st;
+ hcfile.h_data = h_addr;
+
+ c_alloc = 0;
+ /*
+ * Do an initial allocation if the file is "large". Estimate
+ * 32 bytes per line and define "large" as more than half of
+ * the alloc growth size (256 entries).
+ */
+ if (st.st_size >= ESTIMATED_LINELEN * HCFILE_ALLOC_SIZE / 2) {
+ c_alloc = st.st_size / ESTIMATED_LINELEN;
+ hcfile.c_data = malloc(c_alloc * sizeof(struct hcent));
+ if (!hcfile.c_data) {
+ goto oom;
+ }
+ }
+
+ p = (const char *)h_addr;
+ pend = p + st.st_size;
+ while (p < pend) {
+ const char *eol, *addr, *name;
+ size_t len;
+ addr = p;
+ eol = memchr(p, '\n', pend - p);
+ if (!eol)
+ break;
+ p = eol + 1;
+ if (*addr == '#' || *addr == '\n')
+ continue;
+ len = hstrlen(addr);
+ if (len > MAX_ADDRLEN)
+ continue;
+ name = addr + len;
+ while (name < eol && isspace(*name))
+ ++name;
+ while (name < eol) {
+ len = hstrlen(name);
+ if (len == 0)
+ break;
+ if (len < MAX_HOSTLEN) {
+ struct hcent *ent;
+ if (c_alloc <= hcfile.c_len) {
+ struct hcent *c_data;
+ c_alloc += HCFILE_ALLOC_SIZE;
+ c_data = realloc(hcfile.c_data, c_alloc * sizeof(struct hcent));
+ if (!c_data) {
+ goto oom;
+ }
+ hcfile.c_data = c_data;
+ }
+ ent = hcfile.c_data + hcfile.c_len;
+ ent->addr = addr - h_addr;
+ ent->name = name - h_addr;
+ ++hcfile.c_len;
+ }
+ name += len;
+ while (name < eol && isspace(*name))
+ ++name;
+ }
+ }
+
+ qsort(hcfile.c_data, hcfile.c_len,
+ sizeof(struct hcent), cmp_hcent_name);
+
+ flock(h_fd, LOCK_UN);
+
+ return 0;
+
+oom:
+ free(hcfile.c_data);
+ munmap(hcfile.h_data, hcfile.h_st.st_size);
+ flock(hcfile.h_fd, LOCK_UN);
+ close(hcfile.h_fd);
+ memset(&hcfile, 0, sizeof(struct hcfile));
+ return -1;
+}
+
+/*
+ * Caching version of getaddrinfo.
+ *
+ * If we find the requested host name in the cache, use getaddrinfo to
+ * populate the result for each address we find.
+ *
+ * Note glibc and bionic differ in the handling of ai_canonname. POSIX
+ * says that ai_canonname is only populated in the first result entry.
+ * glibc does this. bionic populates ai_canonname in all result entries.
+ * We choose the POSIX/glibc way here.
+ */
+int hc_getaddrinfo(const char *host, const char *service,
+ const struct addrinfo *hints,
+ struct addrinfo **result)
+{
+ int ret = 0;
+ struct hcent *ent, *cur;
+ struct addrinfo *ai;
+ struct addrinfo rhints;
+ struct addrinfo *last;
+ int canonname = 0;
+ int cmp;
+
+ if (getenv("ANDROID_HOSTS_CACHE_DISABLE") != NULL)
+ return EAI_SYSTEM;
+
+ /* Avoid needless work and recursion */
+ if (hints && (hints->ai_flags & AI_NUMERICHOST))
+ return EAI_SYSTEM;
+ if (!host)
+ return EAI_SYSTEM;
+
+ pthread_mutex_lock(&hclock);
+
+ if (_hcfilemmap() != 0) {
+ ret = EAI_SYSTEM;
+ goto out;
+ }
+ ent = _hcfindname(host);
+ if (!ent) {
+ ret = EAI_NONAME;
+ goto out;
+ }
+
+ if (hints) {
+ canonname = (hints->ai_flags & AI_CANONNAME);
+ memcpy(&rhints, hints, sizeof(rhints));
+ rhints.ai_flags &= ~AI_CANONNAME;
+ }
+ else {
+ memset(&rhints, 0, sizeof(rhints));
+ }
+ rhints.ai_flags |= AI_NUMERICHOST;
+
+ last = NULL;
+ cur = ent;
+ do {
+ char addrstr[MAX_ADDRLEN];
+ struct addrinfo *res;
+
+ hstrcpy(addrstr, hcfile.h_data + cur->addr);
+
+ if (getaddrinfo(addrstr, service, &rhints, &res) == 0) {
+ if (!last)
+ (*result)->ai_next = res;
+ else
+ last->ai_next = res;
+ last = res;
+ while (last->ai_next)
+ last = last->ai_next;
+ }
+
+ if(cur + 1 >= hcfile.c_data + hcfile.c_len)
+ break;
+ cmp = cmp_hcent_name(cur, cur + 1);
+ cur = cur + 1;
+ }
+ while (!cmp);
+
+ if (last == NULL) {
+ /* This check is equivalent to (*result)->ai_next == NULL */
+ ret = EAI_NODATA;
+ goto out;
+ }
+
+ if (canonname) {
+ ai = (*result)->ai_next;
+ free(ai->ai_canonname);
+ ai->ai_canonname = hstrdup(hcfile.h_data + ent->name);
+ }
+
+out:
+ pthread_mutex_unlock(&hclock);
+ return ret;
+}
+
+/*
+ * Caching version of gethtbyname.
+ *
+ * Note glibc and bionic differ in the handling of aliases. glibc returns
+ * all aliases for all entries, regardless of whether they match h_addrtype.
+ * bionic returns only the aliases for the first hosts entry. We return all
+ * aliases for all IPv4 entries.
+ *
+ * Additionally, if an alias is IPv6 and the primary name for an alias also
+ * has an IPv4 entry, glibc will return the IPv4 address(es), but bionic
+ * will not. Neither do we.
+ */
+int hc_gethtbyname(const char *host, int af, struct getnamaddr *info)
+{
+ int ret = NETDB_SUCCESS;
+ struct hcent *ent, *cur;
+ int cmp;
+ size_t addrlen;
+ unsigned int naliases = 0;
+ char *aliases[MAXALIASES];
+ unsigned int naddrs = 0;
+ char *addr_ptrs[MAXADDRS];
+ unsigned int n;
+
+ if (getenv("ANDROID_HOSTS_CACHE_DISABLE") != NULL)
+ return NETDB_INTERNAL;
+
+ switch (af) {
+ case AF_INET: addrlen = NS_INADDRSZ; break;
+ case AF_INET6: addrlen = NS_IN6ADDRSZ; break;
+ default:
+ return NETDB_INTERNAL;
+ }
+
+ pthread_mutex_lock(&hclock);
+
+ if (_hcfilemmap() != 0) {
+ ret = NETDB_INTERNAL;
+ goto out;
+ }
+
+ ent = _hcfindname(host);
+ if (!ent) {
+ ret = HOST_NOT_FOUND;
+ goto out;
+ }
+
+ cur = ent;
+ do {
+ char addr[16];
+ char addrstr[MAX_ADDRLEN];
+ char namestr[MAX_HOSTLEN];
+ const char *name;
+
+ hstrcpy(addrstr, hcfile.h_data + cur->addr);
+ if (inet_pton(af, addrstr, &addr) == 1) {
+ char *aligned;
+ /* First match is considered the official hostname */
+ if (naddrs == 0) {
+ hstrcpy(namestr, hcfile.h_data + cur->name);
+ HENT_SCOPY(info->hp->h_name, namestr, info->buf, info->buflen);
+ }
+ for (name = hcfile.h_data + cur->name; name; name = _hcnextname(name)) {
+ if (!hstrcmp(name, host))
+ continue;
+ hstrcpy(namestr, name);
+ HENT_SCOPY(aliases[naliases], namestr, info->buf, info->buflen);
+ ++naliases;
+ if (naliases >= MAXALIASES)
+ goto nospc;
+ }
+ aligned = (char *)ALIGN(info->buf);
+ if (info->buf != aligned) {
+ if ((ptrdiff_t)info->buflen < (aligned - info->buf))
+ goto nospc;
+ info->buflen -= (aligned - info->buf);
+ info->buf = aligned;
+ }
+ HENT_COPY(addr_ptrs[naddrs], addr, addrlen, info->buf, info->buflen);
+ ++naddrs;
+ if (naddrs >= MAXADDRS)
+ goto nospc;
+ }
+
+ if(cur + 1 >= hcfile.c_data + hcfile.c_len)
+ break;
+ cmp = cmp_hcent_name(cur, cur + 1);
+ cur = cur + 1;
+ }
+ while (!cmp);
+
+ if (naddrs == 0) {
+ ret = HOST_NOT_FOUND;
+ goto out;
+ }
+
+ addr_ptrs[naddrs++] = NULL;
+ aliases[naliases++] = NULL;
+
+ /* hp->h_name already populated */
+ HENT_ARRAY(info->hp->h_aliases, naliases, info->buf, info->buflen);
+ for (n = 0; n < naliases; ++n) {
+ info->hp->h_aliases[n] = aliases[n];
+ }
+ info->hp->h_addrtype = af;
+ info->hp->h_length = addrlen;
+ HENT_ARRAY(info->hp->h_addr_list, naddrs, info->buf, info->buflen);
+ for (n = 0; n < naddrs; ++n) {
+ info->hp->h_addr_list[n] = addr_ptrs[n];
+ }
+
+out:
+ pthread_mutex_unlock(&hclock);
+ *info->he = ret;
+ return ret;
+
+nospc:
+ ret = NETDB_INTERNAL;
+ goto out;
+}
diff --git a/libc/dns/net/hosts_cache.h b/libc/dns/net/hosts_cache.h
new file mode 100644
index 000000000..fa5488f51
--- /dev/null
+++ b/libc/dns/net/hosts_cache.h
@@ -0,0 +1,23 @@
+/*
+ * Copyright (C) 2016 The CyanogenMod Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+struct getnamaddr;
+
+int hc_getaddrinfo(const char *host, const char *service,
+ const struct addrinfo *hints,
+ struct addrinfo **result);
+
+int hc_gethtbyname(const char *host, int af, struct getnamaddr *info);
diff --git a/libc/dns/net/sethostent.c b/libc/dns/net/sethostent.c
index 483105a95..1399378cd 100644
--- a/libc/dns/net/sethostent.c
+++ b/libc/dns/net/sethostent.c
@@ -55,6 +55,8 @@ __RCSID("$NetBSD: sethostent.c,v 1.20 2014/03/17 13:24:23 christos Exp $");
#include "hostent.h"
#include "resolv_private.h"
+#include "hosts_cache.h"
+
#ifndef _REENTRANT
void res_close(void);
#endif
@@ -109,6 +111,11 @@ _hf_gethtbyname(void *rv, void *cb_data, va_list ap)
/* NOSTRICT skip string len */(void)va_arg(ap, int);
af = va_arg(ap, int);
+ int rc = hc_gethtbyname(name, af, info);
+ if (rc != NETDB_INTERNAL) {
+ return (rc == NETDB_SUCCESS ? NS_SUCCESS : NS_NOTFOUND);
+ }
+
#if 0
{
res_state res = __res_get_state();

View File

@ -0,0 +1,69 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Tom Marshall <tdm.code@gmail.com>
Date: Thu, 16 Jan 2020 13:07:04 -0800
Subject: [PATCH] bionic: Support wildcards in cached hosts file
If an exact name is not found in the hosts file and the host name
contains at least one dot, search for entries of the form "*.domain",
where domain is the portion of the host name after the first dot. If
that is not found, repeat using the domain.
Example: a.b.c.example.com would search for the following in turn:
a.b.c.example.com
*.b.c.example.com
*.c.example.com
*.example.com
*.com
Change-Id: I4b0bb81699151d5b371850daebf785e35ec9b180
---
libc/dns/net/hosts_cache.c | 29 ++++++++++++++++++++++++++++-
1 file changed, 28 insertions(+), 1 deletion(-)
diff --git a/libc/dns/net/hosts_cache.c b/libc/dns/net/hosts_cache.c
index 52d29e032..fc6370d0c 100644
--- a/libc/dns/net/hosts_cache.c
+++ b/libc/dns/net/hosts_cache.c
@@ -117,7 +117,7 @@ static int cmp_hcent_name(const void *a, const void *b)
return hstrcmp(na, nb);
}
-static struct hcent *_hcfindname(const char *name)
+static struct hcent *_hcfindname_exact(const char *name)
{
size_t first, last, mid;
struct hcent *cur = NULL;
@@ -158,6 +158,33 @@ found:
return cur;
}
+static struct hcent *_hcfindname(const char *name)
+{
+ struct hcent *ent;
+ char namebuf[MAX_HOSTLEN];
+ char *p;
+ char *dot;
+
+ ent = _hcfindname_exact(name);
+ if (!ent && strlen(name) < sizeof(namebuf)) {
+ strcpy(namebuf, name);
+ p = namebuf;
+ do {
+ dot = strchr(p, '.');
+ if (!dot)
+ break;
+ if (dot > p) {
+ *(dot - 1) = '*';
+ ent = _hcfindname_exact(dot - 1);
+ }
+ p = dot + 1;
+ }
+ while (!ent);
+ }
+
+ return ent;
+}
+
/*
* Find next name on line, if any.
*

View File

@ -0,0 +1,35 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Tad <tad@spotco.us>
Date: Wed, 20 Apr 2022 00:40:52 -0400
Subject: [PATCH] Add a toggle to disable /etc/hosts lookup
Signed-off-by: Tad <tad@spotco.us>
Change-Id: I92679c57e73228dc194e61a86ea1a18b2ac90e04
---
libc/dns/net/getaddrinfo.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/libc/dns/net/getaddrinfo.c b/libc/dns/net/getaddrinfo.c
index cc94b21e2..12294da04 100644
--- a/libc/dns/net/getaddrinfo.c
+++ b/libc/dns/net/getaddrinfo.c
@@ -83,6 +83,7 @@
#include <sys/stat.h>
#include <sys/param.h>
#include <sys/socket.h>
+#include <sys/system_properties.h>
#include <sys/un.h>
#include <net/if.h>
#include <netinet/in.h>
@@ -2127,6 +2128,11 @@ _files_getaddrinfo(void *rv, void *cb_data, va_list ap)
name = va_arg(ap, char *);
pai = va_arg(ap, struct addrinfo *);
+ char value[PROP_VALUE_MAX] = { 0 };
+ if (__system_property_get("persist.security.hosts_disable", value) != 0)
+ if (atoi(value) != 0 && strcmp(name, "localhost") != 0 && strcmp(name, "ip6-localhost") != 0)
+ return NS_NOTFOUND;
+
memset(&sentinel, 0, sizeof(sentinel));
cur = &sentinel;
int gai_error = hc_getaddrinfo(name, NULL, pai, &cur);

View File

@ -0,0 +1,86 @@
From 1082d6863ee84feb2f1f6bee871b9f8ad069559e Mon Sep 17 00:00:00 2001
From: harvey186 <harvey186@hotmail.com>
Date: Fri, 15 Dec 2023 18:04:59 +0100
Subject: [PATCH] AdvancedPrivacy
---
sepolicy/netd.te | 1 +
sepolicy/platform_app.te | 11 +++++++++++
sepolicy/service.te | 8 ++++++++
sepolicy/updater_app.te | 22 ++++++++++++++++++++++
4 files changed, 207 insertions(+), 1 deletion(-)
create mode 100644 sepolicy/netd.te
create mode 100644 sepolicy/platform_app.te
create mode 100644 sepolicy/updater_app.te
diff --git a/sepolicy/netd.te b/sepolicy/netd.te
new file mode 100644
index 0000000..bc71718
--- /dev/null
+++ b/sepolicy/netd.te
@@ -0,0 +1 @@
+allow netd platform_app:unix_stream_socket connectto;
diff --git a/sepolicy/platform_app.te b/sepolicy/platform_app.te
new file mode 100644
index 0000000..35445a4
--- /dev/null
+++ b/sepolicy/platform_app.te
@@ -0,0 +1,11 @@
+
+# allow platform_app to create named pipes (used for realm support)
+allow platform_app fuse:fifo_file create;
+allow platform_app app_data_file:fifo_file create_file_perms;
+allow platform_app app_data_file:fifo_file open;
+allow platform_app rs_exec:file rx_file_perms;
+
+# Allow platform apps to execute files in /data
+allow platform_app app_data_file:file execute;
+
+allow platform_app app_data_file:{ lnk_file sock_file fifo_file } create_file_perms;
diff --git a/sepolicy/service.te b/sepolicy/service.te
index a9120f9..8950e39 100644
--- a/sepolicy/service.te
+++ b/sepolicy/service.te
@@ -1 +1,9 @@
type qcrilam_service, service_manager_type;
+
+type adbroot_service, service_manager_type;
+type lineage_hardware_service, system_api_service, system_server_service, service_manager_type;
+type lineage_health_interface_service, system_api_service, system_server_service, service_manager_type;
+type lineage_globalactions_service, system_api_service, system_server_service, service_manager_type;
+type lineage_livedisplay_service, system_api_service, system_server_service, service_manager_type;
+type lineage_profile_service, system_api_service, system_server_service, service_manager_type;
+type lineage_trust_service, system_api_service, system_server_service, service_manager_type;
diff --git a/sepolicy/updater_app.te b/sepolicy/updater_app.te
new file mode 100644
index 0000000..ff82e4e
--- /dev/null
+++ b/sepolicy/updater_app.te
@@ -0,0 +1,22 @@
+type updater_app, domain, coredomain;
+
+app_domain(updater_app)
+net_domain(updater_app)
+
+binder_call(updater_app, gpuservice)
+binder_call(updater_app, update_engine)
+
+allow updater_app app_api_service:service_manager find;
+allow updater_app recovery_service:service_manager find;
+allow updater_app system_api_service:service_manager find;
+allow updater_app system_update_service:service_manager find;
+allow updater_app update_engine_service:service_manager find;
+
+allow updater_app app_data_file:dir create_dir_perms;
+allow updater_app app_data_file:{ file lnk_file } create_file_perms;
+
+allow updater_app cache_file:dir r_dir_perms;
+
+get_prop(updater_app, default_prop)
+get_prop(updater_app, build_prop)
+
--
2.34.1

View File

@ -0,0 +1,40 @@
From be677c64256d6aeb1f7b9e25b7507a5660f63d40 Mon Sep 17 00:00:00 2001
From: harvey186 <harvey186@hotmail.com>
Date: Tue, 19 Dec 2023 12:01:04 +0100
Subject: [PATCH] No_IMSI
Change-Id: I6ec00e7b4af08cdf9df5485c44ee1fc57676dc69
---
.../server/location/gnss/GnssLocationProvider.java | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/services/core/java/com/android/server/location/gnss/GnssLocationProvider.java b/services/core/java/com/android/server/location/gnss/GnssLocationProvider.java
index ed5c1306733e..91ae418aba1f 100644
--- a/services/core/java/com/android/server/location/gnss/GnssLocationProvider.java
+++ b/services/core/java/com/android/server/location/gnss/GnssLocationProvider.java
@@ -1842,7 +1842,12 @@ public class GnssLocationProvider extends AbstractLocationProvider implements
mContext.getSystemService(Context.TELEPHONY_SERVICE);
int type = AGPS_SETID_TYPE_NONE;
String setId = null;
-
+
+ /*
+ * We don't want to tell Google our IMSI or phone number to spy on us!
+ * As devices w/o SIM card also have working GPS, providing this data does
+ * not seem to add a lot of value, at least not for the device holder
+ *
int subId = SubscriptionManager.getDefaultDataSubscriptionId();
if (mGnssConfiguration.isActiveSimEmergencySuplEnabled() && mNIHandler.getInEmergency()
&& mNetworkConnectivityHandler.getActiveSubId() >= 0) {
@@ -1863,7 +1868,7 @@ public class GnssLocationProvider extends AbstractLocationProvider implements
// This means the framework has the SIM card.
type = AGPS_SETID_TYPE_MSISDN;
}
- }
+ } */
mGnssNative.setAgpsSetId(type, (setId == null) ? "" : setId);
}
--
2.34.1

View File

@ -0,0 +1,33 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Daniel Micay <danielmicay@gmail.com>
Date: Mon, 18 Mar 2019 01:54:30 +0200
Subject: [PATCH] stop auto-granting location to system browsers
---
.../pm/permission/DefaultPermissionGrantPolicy.java | 13 -------------
1 file changed, 13 deletions(-)
diff --git a/services/core/java/com/android/server/pm/permission/DefaultPermissionGrantPolicy.java b/services/core/java/com/android/server/pm/permission/DefaultPermissionGrantPolicy.java
index 32ee21cf1658..0443d19ba1d4 100644
--- a/services/core/java/com/android/server/pm/permission/DefaultPermissionGrantPolicy.java
+++ b/services/core/java/com/android/server/pm/permission/DefaultPermissionGrantPolicy.java
@@ -767,19 +767,6 @@ final class DefaultPermissionGrantPolicy {
Intent.CATEGORY_APP_EMAIL, userId),
userId, CONTACTS_PERMISSIONS, CALENDAR_PERMISSIONS);
- // Browser
- String browserPackage = ArrayUtils.firstOrNull(getKnownPackages(
- KnownPackages.PACKAGE_BROWSER, userId));
- if (browserPackage == null) {
- browserPackage = getDefaultSystemHandlerActivityPackageForCategory(pm,
- Intent.CATEGORY_APP_BROWSER, userId);
- if (!pm.isSystemPackage(browserPackage)) {
- browserPackage = null;
- }
- }
- grantPermissionsToPackage(pm, browserPackage, userId, false /* ignoreSystemPackage */,
- true /*whitelistRestrictedPermissions*/, FOREGROUND_LOCATION_PERMISSIONS);
-
// Voice interaction
if (voiceInteractPackageNames != null) {
for (String voiceInteractPackageName : voiceInteractPackageNames) {

View File

@ -0,0 +1,48 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Danny Lin <danny@kdrag0n.dev>
Date: Tue, 12 Oct 2021 01:03:59 +0300
Subject: [PATCH] SystemUI: Use new privacy indicators for location
Android has had location indicators for a while, but let's use the new
privacy indicator infrastructure for displaying them. This makes them
integrate better with the new camera and microphone indicators.
Change-Id: Ie457bb2dad17bddbf9dc3a818e3ec586023ce918
---
core/java/android/permission/PermissionUsageHelper.java | 2 +-
.../src/com/android/systemui/privacy/PrivacyItemController.kt | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/core/java/android/permission/PermissionUsageHelper.java b/core/java/android/permission/PermissionUsageHelper.java
index f5f1c374b636..b3cadb3ea22b 100644
--- a/core/java/android/permission/PermissionUsageHelper.java
+++ b/core/java/android/permission/PermissionUsageHelper.java
@@ -118,7 +118,7 @@ public class PermissionUsageHelper implements AppOpsManager.OnOpActiveChangedLis
private static boolean shouldShowLocationIndicator() {
return DeviceConfig.getBoolean(DeviceConfig.NAMESPACE_PRIVACY,
- PROPERTY_LOCATION_INDICATORS_ENABLED, false);
+ PROPERTY_LOCATION_INDICATORS_ENABLED, true);
}
private static long getRecentThreshold(Long now) {
diff --git a/packages/SystemUI/src/com/android/systemui/privacy/PrivacyItemController.kt b/packages/SystemUI/src/com/android/systemui/privacy/PrivacyItemController.kt
index a676150f44a2..35a9b18d9f69 100644
--- a/packages/SystemUI/src/com/android/systemui/privacy/PrivacyItemController.kt
+++ b/packages/SystemUI/src/com/android/systemui/privacy/PrivacyItemController.kt
@@ -63,7 +63,7 @@ class PrivacyItemController @Inject constructor(
val micCameraAvailable
get() = privacyConfig.micCameraAvailable
val locationAvailable
- get() = privacyConfig.locationAvailable
+ get() = true
val allIndicatorsAvailable
get() = micCameraAvailable && locationAvailable && privacyConfig.mediaProjectionAvailable
@@ -275,4 +275,4 @@ class PrivacyItemController @Inject constructor(
listeningCanceller = delegate.executeDelayed({ setListeningState() }, 0L)
}
}
-}
\ No newline at end of file
+}

View File

@ -0,0 +1,92 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Tad <tad@spotco.us>
Date: Fri, 20 Jan 2023 21:45:50 -0500
Subject: [PATCH] Replace agnss.goog with the Broadcom PSDS server
This is heavily based off of the GrapheneOS patch for their server handling:
https://github.com/GrapheneOS/platform_frameworks_base/commit/f29bedd2aad471b27d1eb6ec3b49e9751d8e0c5a
Change-Id: Idd867bcd55d65d4aae7f9744de4807db46cf4374
Signed-off-by: Tad <tad@spotco.us>
---
.../location/gnss/GnssPsdsDownloader.java | 45 ++++++++++++++-----
1 file changed, 35 insertions(+), 10 deletions(-)
diff --git a/services/core/java/com/android/server/location/gnss/GnssPsdsDownloader.java b/services/core/java/com/android/server/location/gnss/GnssPsdsDownloader.java
index 243910dd9541..07f0f8a6a4af 100644
--- a/services/core/java/com/android/server/location/gnss/GnssPsdsDownloader.java
+++ b/services/core/java/com/android/server/location/gnss/GnssPsdsDownloader.java
@@ -18,6 +18,7 @@ package com.android.server.location.gnss;
import android.annotation.Nullable;
import android.net.TrafficStats;
+import android.os.Build;
import android.util.Log;
import com.android.internal.util.TrafficStatsConstants;
@@ -53,20 +54,39 @@ class GnssPsdsDownloader {
private static final int REALTIME_PSDS_SERVER_INDEX = 3;
private static final int MAX_PSDS_TYPE_INDEX = 3;
+ // Broadcom GNSS almanac server URLs
+ private static final String BROADCOM_LONGTERM_PSDS_SERVER_1 = "https://gllto.glpals.com/7day/v5/latest/lto2.dat";
+ private static final String BROADCOM_LONGTERM_PSDS_SERVER_2 = null;
+ private static final String BROADCOM_LONGTERM_PSDS_SERVER_3 = null;
+ private static final String BROADCOM_NORMAL_PSDS_SERVER = "https://gllto.glpals.com/rto/v1/latest/rto.dat";
+ private static final String BROADCOM_REALTIME_PSDS_SERVER = "https://gllto.glpals.com/rtistatus4.dat";
+
private final String[] mLongTermPsdsServers;
private final String[] mPsdsServers;
// to load balance our server requests
private int mNextServerIndex;
+ private static boolean shouldUseBroadcomServer() {
+ boolean supportedDevice = Build.DEVICE.equals("cheetah") || Build.DEVICE.equals("panther") || Build.DEVICE.equals("raven") || Build.DEVICE.equals("oriole") || Build.DEVICE.equals("bluejay");
+ return supportedDevice;
+ }
+
GnssPsdsDownloader(Properties properties) {
// read PSDS servers from the Properties object
int count = 0;
- String longTermPsdsServer1 = properties.getProperty(
- GnssConfiguration.CONFIG_LONGTERM_PSDS_SERVER_1);
- String longTermPsdsServer2 = properties.getProperty(
- GnssConfiguration.CONFIG_LONGTERM_PSDS_SERVER_2);
- String longTermPsdsServer3 = properties.getProperty(
- GnssConfiguration.CONFIG_LONGTERM_PSDS_SERVER_3);
+ String longTermPsdsServer1;
+ String longTermPsdsServer2;
+ String longTermPsdsServer3;
+
+ if (shouldUseBroadcomServer()) {
+ longTermPsdsServer1 = BROADCOM_LONGTERM_PSDS_SERVER_1;
+ longTermPsdsServer2 = BROADCOM_LONGTERM_PSDS_SERVER_2;
+ longTermPsdsServer3 = BROADCOM_LONGTERM_PSDS_SERVER_3;
+ } else {
+ longTermPsdsServer1 = properties.getProperty(GnssConfiguration.CONFIG_LONGTERM_PSDS_SERVER_1);
+ longTermPsdsServer2 = properties.getProperty(GnssConfiguration.CONFIG_LONGTERM_PSDS_SERVER_2);
+ longTermPsdsServer3 = properties.getProperty(GnssConfiguration.CONFIG_LONGTERM_PSDS_SERVER_3);
+ }
if (longTermPsdsServer1 != null) count++;
if (longTermPsdsServer2 != null) count++;
if (longTermPsdsServer3 != null) count++;
@@ -86,10 +106,15 @@ class GnssPsdsDownloader {
mNextServerIndex = random.nextInt(count);
}
- String normalPsdsServer = properties.getProperty(
- GnssConfiguration.CONFIG_NORMAL_PSDS_SERVER);
- String realtimePsdsServer = properties.getProperty(
- GnssConfiguration.CONFIG_REALTIME_PSDS_SERVER);
+ String normalPsdsServer;
+ String realtimePsdsServer;
+ if (shouldUseBroadcomServer()) {
+ normalPsdsServer = BROADCOM_NORMAL_PSDS_SERVER;
+ realtimePsdsServer = BROADCOM_REALTIME_PSDS_SERVER;
+ } else {
+ normalPsdsServer = properties.getProperty(GnssConfiguration.CONFIG_NORMAL_PSDS_SERVER);
+ realtimePsdsServer = properties.getProperty(GnssConfiguration.CONFIG_REALTIME_PSDS_SERVER);
+ }
mPsdsServers = new String[MAX_PSDS_TYPE_INDEX + 1];
mPsdsServers[NORMAL_PSDS_SERVER_INDEX] = normalPsdsServer;
mPsdsServers[REALTIME_PSDS_SERVER_INDEX] = realtimePsdsServer;

View File

@ -0,0 +1,87 @@
From 00bc7037e82d0064022931d2fa329c94e73590f4 Mon Sep 17 00:00:00 2001
From: harvey186 <harvey186@hotmail.com>
Date: Tue, 19 Dec 2023 11:50:43 +0100
Subject: [PATCH] Random_MAC
Change-Id: Ic36710db4c55cf941e9296fcd0295410d9d2309d
---
.../wifitrackerlib/StandardWifiEntry.java | 32 ++++++++++++++-----
.../com/android/wifitrackerlib/WifiEntry.java | 1 +
2 files changed, 25 insertions(+), 8 deletions(-)
diff --git a/libs/WifiTrackerLib/src/com/android/wifitrackerlib/StandardWifiEntry.java b/libs/WifiTrackerLib/src/com/android/wifitrackerlib/StandardWifiEntry.java
index 1c8e06c2c..54738b2c3 100644
--- a/libs/WifiTrackerLib/src/com/android/wifitrackerlib/StandardWifiEntry.java
+++ b/libs/WifiTrackerLib/src/com/android/wifitrackerlib/StandardWifiEntry.java
@@ -253,7 +253,7 @@ public class StandardWifiEntry extends WifiEntry {
return wifiInfoMac;
}
}
- if (mTargetWifiConfig == null || getPrivacy() != PRIVACY_RANDOMIZED_MAC) {
+ if (mTargetWifiConfig == null || getPrivacy() == PRIVACY_DEVICE_MAC) {
final String[] factoryMacs = mWifiManager.getFactoryMacAddresses();
if (factoryMacs.length > 0) {
return factoryMacs[0];
@@ -538,12 +538,18 @@ public class StandardWifiEntry extends WifiEntry {
@Override
@Privacy
public synchronized int getPrivacy() {
- if (mTargetWifiConfig != null
- && mTargetWifiConfig.macRandomizationSetting
- == WifiConfiguration.RANDOMIZATION_NONE) {
- return PRIVACY_DEVICE_MAC;
+ if (mTargetWifiConfig != null) {
+ switch (mTargetWifiConfig.macRandomizationSetting) {
+ case WifiConfiguration.RANDOMIZATION_NONE:
+ return PRIVACY_DEVICE_MAC;
+ case WifiConfiguration.RANDOMIZATION_ALWAYS:
+ return PRIVACY_RANDOMIZATION_ALWAYS;
+ default:
+ // WifiConfiguration.RANDOMIZATION_AUTO and WifiConfiguration.RANDOMIZATION_PERSISTENT
+ return PRIVACY_RANDOMIZED_MAC;
+ }
} else {
- return PRIVACY_RANDOMIZED_MAC;
+ return PRIVACY_RANDOMIZATION_ALWAYS;
}
}
@@ -555,11 +561,21 @@ public class StandardWifiEntry extends WifiEntry {
// Refresh the current config so we don't overwrite any changes that we haven't gotten
// the CONFIGURED_NETWORKS_CHANGED broadcast for yet.
refreshTargetWifiConfig();
- mTargetWifiConfig.macRandomizationSetting = privacy == PRIVACY_RANDOMIZED_MAC
- ? WifiConfiguration.RANDOMIZATION_AUTO : WifiConfiguration.RANDOMIZATION_NONE;
+ mTargetWifiConfig.macRandomizationSetting = translatePrivacyToWifiConfigurationValues(privacy);
mWifiManager.save(mTargetWifiConfig, null /* listener */);
}
+ private static int translatePrivacyToWifiConfigurationValues(int privacyValue) {
+ switch (privacyValue) {
+ case PRIVACY_RANDOMIZED_MAC:
+ return WifiConfiguration.RANDOMIZATION_PERSISTENT;
+ case PRIVACY_DEVICE_MAC:
+ return WifiConfiguration.RANDOMIZATION_NONE;
+ default:
+ return WifiConfiguration.RANDOMIZATION_ALWAYS;
+ }
+ }
+
@Override
public synchronized boolean isAutoJoinEnabled() {
if (mTargetWifiConfig == null) {
diff --git a/libs/WifiTrackerLib/src/com/android/wifitrackerlib/WifiEntry.java b/libs/WifiTrackerLib/src/com/android/wifitrackerlib/WifiEntry.java
index 0dea00695..675265c2d 100644
--- a/libs/WifiTrackerLib/src/com/android/wifitrackerlib/WifiEntry.java
+++ b/libs/WifiTrackerLib/src/com/android/wifitrackerlib/WifiEntry.java
@@ -142,6 +142,7 @@ public class WifiEntry {
public static final int PRIVACY_DEVICE_MAC = 0;
public static final int PRIVACY_RANDOMIZED_MAC = 1;
public static final int PRIVACY_UNKNOWN = 2;
+ public static final int PRIVACY_RANDOMIZATION_ALWAYS = 100;
@Retention(RetentionPolicy.SOURCE)
@IntDef(value = {
--
2.34.1

View File

@ -0,0 +1,25 @@
From 1b7ef198a642366147806eca6184028e649c3594 Mon Sep 17 00:00:00 2001
From: harvey186 <harvey186@hotmail.com>
Date: Fri, 15 Dec 2023 18:17:04 +0100
Subject: [PATCH] AdvancedPrivacy
Change-Id: I0eaa178ef7621670ce7f193fd28c82bcdc47ef2f
---
.../com/android/permissioncontroller/permission/utils/Utils.java | 1 +
1 file changed, 1 insertion(+)
diff --git a/PermissionController/src/com/android/permissioncontroller/permission/utils/Utils.java b/PermissionController/src/com/android/permissioncontroller/permission/utils/Utils.java
index d4354bd72..4b90f9327 100644
--- a/PermissionController/src/com/android/permissioncontroller/permission/utils/Utils.java
+++ b/PermissionController/src/com/android/permissioncontroller/permission/utils/Utils.java
@@ -21,6 +21,7 @@ import static android.Manifest.permission_group.CALENDAR;
import static android.Manifest.permission_group.CALL_LOG;
import static android.Manifest.permission_group.CAMERA;
import static android.Manifest.permission_group.CONTACTS;
+import static android.Manifest.permission_group.FAKE_PACKAGE;
import static android.Manifest.permission_group.LOCATION;
import static android.Manifest.permission_group.MICROPHONE;
import static android.Manifest.permission_group.NEARBY_DEVICES;
--
2.34.1

View File

@ -0,0 +1,877 @@
From 5d86692715535a48160874daa93f2f84487987e3 Mon Sep 17 00:00:00 2001
From: harvey186 <harvey186@hotmail.com>
Date: Fri, 15 Dec 2023 18:10:47 +0100
Subject: [PATCH] AdvancedPrivacy
Change-Id: Ida72ce1fb19f10294a26f43d69e517ed1a75b5a0
---
res/drawable/ic_homepage_advanced_privacy.xml | 41 +++
...een.xml => ic_illustration_fullscreen.xml} | 0
..._switch.xml => ic_illustration_switch.xml} | 0
..._window.xml => ic_illustration_window.xml} | 0
res/drawable/ic_launcher_background.xml | 37 +++
res/values/arrays.xml | 21 ++
res/values/cm_strings.xml | 196 ++++++++++++
res/values/strings.xml | 8 +-
.../advanced_privacy_dashboard_settings.xml | 28 ++
res/xml/bubble_notification_settings.xml | 5 +-
res/xml/top_level_settings.xml | 10 +-
...ConnectivityCheckPreferenceController.java | 295 ++++++++++++++++++
.../network/NetworkDashboardFragment.java | 3 +
.../AdvancedPrivacyDashboardFragment.java | 52 +++
.../android/settings/wifi/WifiStatusTest.java | 4 +-
20 files changed, 692 insertions(+), 477 deletions(-)
create mode 100644 res/drawable/ic_homepage_advanced_privacy.xml
rename res/drawable/{accessibility_magnification_mode_fullscreen.xml => ic_illustration_fullscreen.xml} (100%)
rename res/drawable/{accessibility_magnification_mode_switch.xml => ic_illustration_switch.xml} (100%)
rename res/drawable/{accessibility_magnification_mode_window.xml => ic_illustration_window.xml} (100%)
create mode 100644 res/drawable/ic_launcher_background.xml
create mode 100644 res/values/cm_strings.xml
create mode 100644 res/xml/advanced_privacy_dashboard_settings.xml
create mode 100644 src/com/android/settings/network/ConnectivityCheckPreferenceController.java
create mode 100644 src/com/android/settings/privacy/AdvancedPrivacyDashboardFragment.java
diff --git a/res/drawable/ic_homepage_advanced_privacy.xml b/res/drawable/ic_homepage_advanced_privacy.xml
new file mode 100644
index 0000000000..3786ebb858
--- /dev/null
+++ b/res/drawable/ic_homepage_advanced_privacy.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright ECORP SAS 2022
+ ~ This program is free software: you can redistribute it and/or modify
+ ~ it under the terms of the GNU General Public License as published by
+ ~ the Free Software Foundation, either version 3 of the License, or
+ ~ (at your option) any later version.
+ ~
+ ~ This program is distributed in the hope that it will be useful,
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ ~ GNU General Public License for more details.
+ ~
+ ~ You should have received a copy of the GNU General Public License
+ ~ along with this program. If not, see <https://www.gnu.org/licenses/>.
+ -->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="36dp"
+ android:height="36dp"
+ android:viewportWidth="32"
+ android:viewportHeight="32">
+ <group>
+ <clip-path
+ android:pathData="M0,0h32v32h-32z"/>
+ <path
+ android:pathData="M7,0L25,0A7,7 0,0 1,32 7L32,25A7,7 0,0 1,25 32L7,32A7,7 0,0 1,0 25L0,7A7,7 0,0 1,7 0z"
+ android:fillColor="#2CCF69"/>
+ <path
+ android:pathData="M15.983,6.667V6.667C15.917,6.666 15.85,6.675 15.785,6.693L7.869,10.044C7.815,10.069 7.765,10.111 7.727,10.168C7.689,10.228 7.667,10.301 7.667,10.377L7.667,10.379C7.667,18.181 12.058,23.35 15.862,24.975L15.865,24.977C15.902,24.992 15.94,25 15.978,25C16.016,25 16.054,24.992 16.091,24.977L16.097,24.974L16.097,24.974C19.126,23.687 24.324,19.049 24.333,10.402C24.33,10.323 24.305,10.248 24.263,10.186C24.22,10.122 24.162,10.075 24.099,10.049C24.099,10.049 24.099,10.049 24.099,10.049L16.169,6.691C16.112,6.675 16.053,6.667 15.994,6.667L15.983,6.667ZM16.75,5.127L24.75,8.514C25.114,8.669 25.425,8.927 25.647,9.258C25.869,9.589 25.992,9.979 26,10.379C26,19.777 20.332,24.986 16.749,26.508C16.505,26.613 16.243,26.667 15.978,26.667C15.713,26.667 15.451,26.613 15.207,26.508C10.749,24.603 6,18.803 6,10.379C5.999,9.982 6.114,9.594 6.328,9.262C6.543,8.931 6.849,8.671 7.208,8.514L15.207,5.127C15.463,5.041 15.73,4.998 15.999,5C16.255,5.001 16.508,5.044 16.75,5.127Z"
+ android:fillColor="#ffffff"
+ android:fillType="evenOdd"/>
+ <path
+ android:pathData="M13.672,11.986C13.998,12.312 13.998,12.84 13.672,13.165C13.03,13.808 12.708,14.649 12.708,15.493C12.708,16.336 13.03,17.177 13.672,17.82C14.315,18.463 15.156,18.784 16,18.784C16.844,18.784 17.684,18.463 18.327,17.82C18.97,17.177 19.291,16.336 19.291,15.493C19.291,14.649 18.97,13.808 18.327,13.165C18.002,12.84 18.002,12.312 18.327,11.986C18.653,11.661 19.18,11.661 19.506,11.986C20.474,12.955 20.958,14.225 20.958,15.493C20.958,16.76 20.474,18.03 19.506,18.998C18.538,19.966 17.267,20.451 16,20.451C14.732,20.451 13.462,19.966 12.494,18.998C11.526,18.03 11.042,16.76 11.042,15.493C11.042,14.225 11.526,12.955 12.494,11.986C12.819,11.661 13.347,11.661 13.672,11.986Z"
+ android:fillColor="#ffffff"
+ android:fillType="evenOdd"/>
+ <path
+ android:pathData="M16.085,11C16.545,11 16.918,11.373 16.918,11.833L16.918,15.554C16.918,16.014 16.545,16.387 16.085,16.387C15.624,16.387 15.251,16.014 15.251,15.554L15.251,11.833C15.251,11.373 15.624,11 16.085,11Z"
+ android:fillColor="#ffffff"
+ android:fillType="evenOdd"/>
+ </group>
+</vector>
diff --git a/res/drawable/accessibility_magnification_mode_fullscreen.xml b/res/drawable/ic_illustration_fullscreen.xml
similarity index 100%
rename from res/drawable/accessibility_magnification_mode_fullscreen.xml
rename to res/drawable/ic_illustration_fullscreen.xml
diff --git a/res/drawable/accessibility_magnification_mode_switch.xml b/res/drawable/ic_illustration_switch.xml
similarity index 100%
rename from res/drawable/accessibility_magnification_mode_switch.xml
rename to res/drawable/ic_illustration_switch.xml
diff --git a/res/drawable/accessibility_magnification_mode_window.xml b/res/drawable/ic_illustration_window.xml
similarity index 100%
rename from res/drawable/accessibility_magnification_mode_window.xml
rename to res/drawable/ic_illustration_window.xml
diff --git a/res/drawable/ic_launcher_background.xml b/res/drawable/ic_launcher_background.xml
new file mode 100644
index 0000000000..b91ae32786
--- /dev/null
+++ b/res/drawable/ic_launcher_background.xml
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright ECORP SAS 2022
+ ~ This program is free software: you can redistribute it and/or modify
+ ~ it under the terms of the GNU General Public License as published by
+ ~ the Free Software Foundation, either version 3 of the License, or
+ ~ (at your option) any later version.
+ ~
+ ~ This program is distributed in the hope that it will be useful,
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ ~ GNU General Public License for more details.
+ ~
+ ~ You should have received a copy of the GNU General Public License
+ ~ along with this program. If not, see <https://www.gnu.org/licenses/>.
+ -->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:aapt="http://schemas.android.com/aapt"
+ android:width="108dp"
+ android:height="108dp"
+ android:viewportWidth="108"
+ android:viewportHeight="108">
+ <path
+ android:pathData="M0,0h108v108h-108z">
+ <aapt:attr name="android:fillColor">
+ <gradient
+ android:startX="54"
+ android:startY="7.15"
+ android:endX="54"
+ android:endY="208.35"
+ android:type="linear">
+ <item android:offset="0" android:color="#FFD8DDDF"/>
+ <item android:offset="1" android:color="#FF949DA1"/>
+ </gradient>
+ </aapt:attr>
+ </path>
+</vector>
diff --git a/res/values/arrays.xml b/res/values/arrays.xml
index 1ab9876720..169a7bfb21 100644
--- a/res/values/arrays.xml
+++ b/res/values/arrays.xml
@@ -82,6 +82,27 @@
<item>10 minutes</item>
<item>30 minutes</item>
</string-array>
+
+ <string-array name="connectivity_check_entries">
+ <item>Disabled</item>
+ <item>DivestOS (US)</item>
+ <item>Kuketz (DE) [default]</item>
+ <item>openSUSE (DE)</item>
+ <item>Ubuntu (UK)</item>
+ <item>Graphene (US)</item>
+ <item>Kuketz (DE)</item>
+ </string-array>
+
+ <string-array name="connectivity_check_values" translatable="false">
+ <item>0</item>
+ <item>1</item>
+ <item>2</item>
+ <item>3</item>
+ <item>4</item>
+ <item>5</item>
+ <item>6</item>
+ </string-array>
+
<!-- Do not translate. -->
<string-array name="lock_after_timeout_values" translatable="false">
diff --git a/res/values/cm_strings.xml b/res/values/cm_strings.xml
new file mode 100644
index 0000000000..4da3fdca8c
--- /dev/null
+++ b/res/values/cm_strings.xml
@@ -0,0 +1,196 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2017-2023 The LineageOS Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+ <!-- Private DNS -->
+ <string name="private_dns_mode_cloudflare" translatable="false">Cloudflare DNS</string>
+ <!-- Alternative: 1dot1dot1dot1.cloudflare-dns.com -->
+ <string name="private_dns_hostname_cloudflare" translatable="false">9.9.9.9</string>
+
+ <!-- Advanced keyboard settings -->
+ <string name="keyboard_extras_title">Extras</string>
+ <string name="advanced_keyboard_settings_title">Advanced settings</string>
+
+ <!-- Android debugging as root -->
+ <string name="adb_enable_root">Rooted debugging</string>
+ <string name="adb_enable_summary_root">Allow running Android debugging as root</string>
+
+ <!-- Backup Transport selection settings menu and activity title -->
+ <string name="backup_transport_setting_label">Change backup provider</string>
+ <string name="backup_transport_title">Select backup provider</string>
+
+ <!-- Black theme for dark mode -->
+ <string name="berry_black_theme_title">Pure black</string>
+ <string name="berry_black_theme_summary">Pure black background for dark theme</string>
+
+ <!-- Device Info screen. LineageOS legal. -->
+ <string name="lineagelicense_title">LineageOS legal</string>
+
+ <!-- String for removal of sensitive info on about, depending on tap -->
+ <string name="device_info_protected_single_press">Tap to show info</string>
+
+ <!-- [CHAR LIMIT=NONE] Device Info screen. Countdown for user taps to enable development settings -->
+ <plurals name="show_dev_countdown_cm">
+ <item quantity="one">You are now <xliff:g id="step_count">%1$d</xliff:g> step away from enabling development settings.</item>
+ <item quantity="other">You are now <xliff:g id="step_count">%1$d</xliff:g> steps away from enabling development settings.</item>
+ </plurals>
+ <!-- [CHAR LIMIT=NONE] Device Info screen. Confirmation that developer settings are enabled -->
+ <string name="show_dev_on_cm">You have enabled development settings!</string>
+ <!-- [CHAR LIMIT=NONE] Device Info screen. Okay we get it, stop pressing, you already have it on -->
+ <string name="show_dev_already_cm">No need, you have already enabled development settings.</string>
+
+ <!-- Display settings screen, peak refresh rate settings summary [CHAR LIMIT=NONE] -->
+ <string name="peak_refresh_rate_summary_custom">Automatically raises the refresh rate from 60 to %1$d Hz for some content. Increases battery usage.</string>
+
+ <!-- Double tap to sleep on status bar or lockscreen -->
+ <string name="status_bar_double_tap_to_sleep_title">Tap to sleep</string>
+ <string name="status_bar_double_tap_to_sleep_summary">Double-tap on the status bar or lockscreen to turn off the display</string>
+
+ <!-- High touch polling rate -->
+ <string name="high_touch_polling_rate_title">High touch polling rate</string>
+ <string name="high_touch_polling_rate_summary">Increase touchscreen polling rate</string>
+
+ <!-- Heads-up -->
+ <string name="heads_up_notifications_enabled_title">Heads-up</string>
+ <string name="heads_up_notifications_enabled_summary">Display priority notifications in a small floating window</string>
+
+ <!-- High touch sensitivity -->
+ <string name="high_touch_sensitivity_title">High touch sensitivity</string>
+ <string name="high_touch_sensitivity_summary">Increase touchscreen sensitivity so it can be used while wearing gloves</string>
+
+ <!-- Hotspot extras -->
+ <string name="tethering_allow_vpn_upstreams_title">Allow clients to use VPNs</string>
+ <string name="tethering_allow_vpn_upstreams_summary">Permit hotspot clients to use this device\u2019s VPN connections for upstream connectivity</string>
+
+ <!-- Increasing ring tone volume -->
+ <string name="increasing_ring_volume_option_title">Increasing ring volume</string>
+ <string name="increasing_ring_min_volume_title">Start volume</string>
+ <string name="increasing_ring_ramp_up_time_title">Ramp-up time</string>
+
+ <!-- Lock screen cover art -->
+ <string name="lockscreen_media_art_title">Display media cover art</string>
+
+ <!-- Lock screen pattern size -->
+ <string name="lock_pattern_size_3" translatable="false">3 \u00d7 3</string>
+ <string name="lock_pattern_size_4" translatable="false">4 \u00d7 4</string>
+ <string name="lock_pattern_size_5" translatable="false">5 \u00d7 5</string>
+ <string name="lock_pattern_size_6" translatable="false">6 \u00d7 6</string>
+ <string name="lock_settings_picker_pattern_size_message">Choose a pattern size</string>
+ <!-- Whether a visible red line will be drawn after the user has drawn the unlock pattern incorrectly -->
+ <string name="lockpattern_settings_enable_error_path_title">Show pattern error</string>
+ <!-- Whether the dots will be drawn when using the lockscreen pattern -->
+ <string name="lockpattern_settings_enable_dots_title">Show pattern dots</string>
+
+ <!-- Max refresh rate -->
+ <string name="max_refresh_rate_title">Peak refresh rate</string>
+
+ <!-- Min refresh rate -->
+ <string name="min_refresh_rate_title">Minimum refresh rate</string>
+
+ <!-- Message shown in fingerprint enrollment dialog to locate the sensor -->
+ <string name="fingerprint_enroll_find_sensor_message_front" product="tablet">Locate the fingerprint sensor on the front of your tablet.</string>
+ <string name="fingerprint_enroll_find_sensor_message_front" product="device">Locate the fingerprint sensor on the front of your device.</string>
+ <string name="fingerprint_enroll_find_sensor_message_front" product="default">Locate the fingerprint sensor on the front of your phone.</string>
+ <string name="fingerprint_enroll_find_sensor_message_rear" product="tablet">Locate the fingerprint sensor on the back of your tablet.</string>
+ <string name="fingerprint_enroll_find_sensor_message_rear" product="device">Locate the fingerprint sensor on the back of your device.</string>
+ <string name="fingerprint_enroll_find_sensor_message_rear" product="default">Locate the fingerprint sensor on the back of your phone.</string>
+ <string name="fingerprint_enroll_find_sensor_message_side" product="tablet">Locate the fingerprint sensor on the side of your tablet.</string>
+ <string name="fingerprint_enroll_find_sensor_message_side" product="device">Locate the fingerprint sensor on the side of your device.</string>
+ <string name="fingerprint_enroll_find_sensor_message_side" product="default">Locate the fingerprint sensor on the side of your phone.</string>
+
+ <!-- Message shown when user touches the icon on the screen, instead of the real fingerprint sensor -->
+ <string name="fingerprint_enroll_touch_dialog_message_front" product="tablet">Touch the sensor on the front of your tablet.</string>
+ <string name="fingerprint_enroll_touch_dialog_message_front" product="device">Touch the sensor on the front of your device.</string>
+ <string name="fingerprint_enroll_touch_dialog_message_front" product="default">Touch the sensor on the front of your phone.</string>
+ <string name="fingerprint_enroll_touch_dialog_message_rear" product="tablet">Touch the sensor on the back of your tablet.</string>
+ <string name="fingerprint_enroll_touch_dialog_message_rear" product="device">Touch the sensor on the back of your device.</string>
+ <string name="fingerprint_enroll_touch_dialog_message_rear" product="default">Touch the sensor on the back of your phone.</string>
+ <string name="fingerprint_enroll_touch_dialog_message_side" product="tablet">Touch the sensor on the side of your tablet.</string>
+ <string name="fingerprint_enroll_touch_dialog_message_side" product="device">Touch the sensor on the side of your device.</string>
+ <string name="fingerprint_enroll_touch_dialog_message_side" product="default">Touch the sensor on the side of your phone.</string>
+
+ <!-- Navigation bar hint -->
+ <string name="show_navbar_hint_title">Navigation hint</string>
+ <string name="show_navbar_hint_summary">Show navigation hint bar at the bottom of the screen</string>
+
+ <!-- Notification sound timeout -->
+ <string name="app_notification_sound_timeout_title">Minimum time between notification sounds</string>
+ <string name="app_notification_sound_timeout_summary_template">Allow sounds or vibration no more than once every <xliff:g id="duration">%1$s</xliff:g></string>
+ <string name="app_notification_sound_timeout_value_none">No restriction</string>
+ <string name="app_notification_sound_timeout_value_10_seconds">10 seconds</string>
+ <string name="app_notification_sound_timeout_value_30_seconds">30 seconds</string>
+ <string name="app_notification_sound_timeout_value_1_minute">1 minute</string>
+ <string name="app_notification_sound_timeout_value_5_minutes">5 minutes</string>
+ <string name="app_notification_sound_timeout_value_15_minutes">10 minutes</string>
+ <string name="app_notification_sound_timeout_value_30_minutes">30 minutes</string>
+
+ <!-- One shot automatic brightness -->
+ <string name="auto_brightness_one_shot_title">One shot auto-brightness</string>
+ <string name="auto_brightness_one_shot_summary">Brightness adjustment will only occur at the moment the screen is turned on</string>
+
+ <!-- Per-app data restrictions -->
+ <string name="data_usage_app_restrict_all">Allow network access</string>
+ <string name="data_usage_app_restrict_all_summary">Enable network usage</string>
+ <string name="data_usage_app_restrict_mobile">Mobile data</string>
+ <string name="data_usage_app_restrict_mobile_summary">Enable usage of mobile data</string>
+ <string name="data_usage_app_restrict_vpn">VPN data</string>
+ <string name="data_usage_app_restrict_vpn_summary">Enable usage of VPN data</string>
+ <string name="data_usage_app_restrict_wifi">Wi\u2011Fi data</string>
+ <string name="data_usage_app_restrict_wifi_summary">Enable usage of Wi\u2011Fi data</string>
+
+ <!-- PIN scramble -->
+ <string name="unlock_scramble_pin_layout_title">Scramble layout</string>
+ <string name="unlock_scramble_pin_layout_summary">Scramble PIN layout when unlocking device</string>
+
+ <!-- Proximity wake -->
+ <string name="proximity_wake_title">Prevent accidental wake-up</string>
+ <string name="proximity_wake_summary">Check the proximity sensor prior to waking up screen</string>
+
+ <!-- Touchscreen gesture settings -->
+ <string name="touchscreen_gesture_settings_title">Touchscreen gestures</string>
+ <string name="touchscreen_gesture_settings_summary">Perform various touchscreen gestures for quick actions</string>
+
+ <!-- Touchscreen hovering -->
+ <string name="touchscreen_hovering_title">Touchscreen hovering</string>
+ <string name="touchscreen_hovering_summary">Allows you to hover the screen like a mouse in web browsers, remote desktops, etc</string>
+
+ <!-- Wake on plug -->
+ <string name="wake_when_plugged_or_unplugged_title">Wake on plug</string>
+ <string name="wake_when_plugged_or_unplugged_summary">Turn the screen on when connecting or disconnecting a power source</string>
+
+ <!-- FastCharge feature -->
+ <string name="fast_charging_title">Fast charging</string>
+ <string name="fast_charging_summary">Disable to reduce the heat produced by the device while charging or to extend the lifespan of the battery</string>
+
+ <!-- Preference and settings suggestion title text for screen off UDFPS (phone) [CHAR LIMIT=60]-->
+ <string name="ambient_display_screen_off_udfps_title" product="default">Long press on fingerprint sensor to unlock phone</string>
+ <!-- Preference and settings suggestion title text for screen off UDFPS (tablet) [CHAR LIMIT=60]-->
+ <string name="ambient_display_screen_off_udfps_title" product="tablet">Long press on fingerprint sensor to unlock tablet</string>
+ <!-- Preference and settings suggestion title text for screen off UDFPS (device) [CHAR LIMIT=60]-->
+ <string name="ambient_display_screen_off_udfps_title" product="device">Long press on fingerprint sensor to unlock device</string>
+ <!-- Summary text for screen off UDFPS [CHAR LIMIT=NONE]-->
+ <string name="ambient_display_screen_off_udfps_summary">To wake up your screen and unlock, long press your under-display fingerprint sensor.</string>
+
+ <!-- Warning message for the sd card setup -->
+ <string name="storage_warning_internal">Warning: This option may not work properly or lead to data loss and is therefore not recommended!</string>
+
+ <!-- Location settings screen, setting summary for Assisted GPS switch -->
+ <string name="assisted_gps_summary">Download satellite assistance data from the internet which can greatly improve the GPS startup performance. For emergency calls, assisted GPS is always allowed.</string>
+
+ <!-- LeOS Advanced Privacy -->
+ <string name="advanced_privacy_dashboard_title" translatable="false">Advanced Privacy</string>
+ <string name="advanced_privacy_dashboard_summary">Manage trackers, fake location, hide IP address</string>
+</resources>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index b5e993fe84..69a03bd4f9 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -639,6 +639,9 @@
<!-- TODO(b/208624929): Update to an UX approved summary and char limit. -->
<!-- Main Settings screen setting summary for the item that takes you to the privacy and security settings. [CHAR LIMIT=60] -->
<string name="safety_center_summary">App security, device lock, permissions</string>
+
+ <!-- Summary for e Security settings, explaining a few important settings under it [CHAR LIMIT=NONE] -->
+ <string name="security_dashboard_summary_e">Screen lock, app security</string>
<!-- Face enrollment and settings --><skip />
<!-- Note: Update FaceEnrollParentalConsent.CONSENT_STRING_RESOURCES when any _consent_ strings are added or removed. -->
@@ -2314,7 +2317,7 @@
<!-- Message of private dns that provides a help link. [CHAR LIMIT=NONE] -->
<string name="private_dns_help_message"><annotation id="url">Learn more</annotation> about Private DNS features</string>
<!-- Message to display when private dns is on. [CHAR LIMIT=10] -->
- <string name="private_dns_mode_on">On</string>
+ <string name="private_dns_mode_on">Off</string>
<!-- Message to display when wifi calling needs activation [CHAR LIMIT=NONE] -->
<string name="wifi_calling_settings_activation_instructions">Activate Wi\u2011Fi Calling</string>
@@ -12314,4 +12317,7 @@
<!-- Warning message when we try to dock an app not supporting multiple instances split into multiple sides [CHAR LIMIT=NONE] -->
<string name="dock_multi_instances_not_supported_text">"This app can only be opened in 1 window"</string>
+ <string name="connectivity_check_title">Internet connectivity check</string>
+ <string name="connectivity_check_summary">HTTP endpoints to use for performing internet connectivity checks.</string>
+
</resources>
diff --git a/res/xml/advanced_privacy_dashboard_settings.xml b/res/xml/advanced_privacy_dashboard_settings.xml
new file mode 100644
index 0000000000..8433a4402a
--- /dev/null
+++ b/res/xml/advanced_privacy_dashboard_settings.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2019-2022 ECORP SAS
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+
+<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:settings="http://schemas.android.com/apk/res-auto"
+ android:key="advanced_privacy"
+ android:title="@string/advanced_privacy_dashboard_title">
+
+ <Preference>
+ <intent android:action="android.intent.action.MAIN"
+ android:targetPackage="foundation.e.advancedprivacy"
+ android:targetClass="foundation.e.privacycentralapp.main.MainActivity" />
+ </Preference>
+</PreferenceScreen>
diff --git a/res/xml/bubble_notification_settings.xml b/res/xml/bubble_notification_settings.xml
index 3e137d7001..82a89a3249 100644
--- a/res/xml/bubble_notification_settings.xml
+++ b/res/xml/bubble_notification_settings.xml
@@ -26,10 +26,7 @@
<com.android.settingslib.widget.IllustrationPreference
android:key="bubbles_illustration"
settings:searchable="false"
- app:lottie_rawRes="@raw/lottie_bubbles"
- app:lottie_cacheComposition="false"
- settings:dynamicColor="true"
- settings:controller="com.android.settings.notification.BubbleNotificationIllustrationPreferenceController"/>
+ app:lottie_rawRes="@raw/lottie_bubbles"/>
<com.android.settingslib.widget.MainSwitchPreference
android:key="global_notification_bubbles"
diff --git a/res/xml/top_level_settings.xml b/res/xml/top_level_settings.xml
index d050a1f274..0c0db84657 100644
--- a/res/xml/top_level_settings.xml
+++ b/res/xml/top_level_settings.xml
@@ -141,7 +141,7 @@
android:key="top_level_security"
android:order="-50"
android:title="@string/security_settings_title"
- android:summary="@string/security_dashboard_summary"
+ android:summary="@string/security_dashboard_summary_e"
settings:highlightableMenuKey="@string/menu_key_security"
settings:controller="com.android.settings.security.TopLevelSecurityEntryPreferenceController"/>
@@ -155,6 +155,14 @@
settings:highlightableMenuKey="@string/menu_key_privacy"
settings:controller="com.android.settings.privacy.TopLevelPrivacyEntryPreferenceController"/>
+ <com.android.settings.widget.HomepagePreference
+ android:key="top_level_advanced_privacy"
+ android:title="@string/advanced_privacy_dashboard_title"
+ android:summary="@string/advanced_privacy_dashboard_summary"
+ android:icon="@drawable/ic_homepage_advanced_privacy"
+ android:order="-35"
+ android:fragment="com.android.settings.privacy.AdvancedPrivacyDashboardFragment"/>
+
<com.android.settings.widget.HomepagePreference
android:fragment="com.android.settings.location.LocationSettings"
android:icon="@drawable/ic_settings_location"
diff --git a/src/com/android/settings/network/ConnectivityCheckPreferenceController.java b/src/com/android/settings/network/ConnectivityCheckPreferenceController.java
new file mode 100644
index 0000000000..04bcbe3b60
--- /dev/null
+++ b/src/com/android/settings/network/ConnectivityCheckPreferenceController.java
@@ -0,0 +1,295 @@
+/*
+ * Copyright (C) 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.settings.network;
+
+import android.content.ContentResolver;
+import android.content.Context;
+import android.content.res.Resources;
+import android.database.ContentObserver;
+import android.net.LinkProperties;
+import android.net.Network;
+import android.os.Handler;
+import android.os.Looper;
+import android.os.UserHandle;
+import android.os.UserManager;
+import android.provider.Settings;
+import androidx.preference.ListPreference;
+import androidx.preference.Preference;
+import androidx.preference.PreferenceScreen;
+import com.android.internal.util.ArrayUtils;
+import com.android.settings.R;
+import com.android.settings.core.BasePreferenceController;
+import com.android.settings.core.PreferenceControllerMixin;
+import com.android.settingslib.RestrictedLockUtils.EnforcedAdmin;
+import com.android.settingslib.RestrictedLockUtilsInternal;
+import com.android.settingslib.core.lifecycle.events.OnResume;
+
+public class ConnectivityCheckPreferenceController
+ extends BasePreferenceController
+ implements PreferenceControllerMixin, Preference.OnPreferenceChangeListener,
+ OnResume {
+
+ // imported defaults from AOSP NetworkStack
+ private static final String STANDARD_HTTPS_URL =
+ "http://captiveportal.kuketz.de/generate_204";
+ private static final String STANDARD_HTTP_URL =
+ "http://captiveportal.kuketz.de/generate_204";
+ private static final String STANDARD_FALLBACK_URL =
+ "http://captiveportal.kuketz.de/gen_204";
+ private static final String STANDARD_OTHER_FALLBACK_URLS =
+ "http://captiveportal.kuketz.de/generate_204";
+
+ // GrapheneOS
+ private static final String GRAPHENEOS_CAPTIVE_PORTAL_HTTPS_URL =
+ "https://connectivitycheck.grapheneos.network/generate_204";
+ private static final String GRAPHENEOS_CAPTIVE_PORTAL_HTTP_URL =
+ "http://connectivitycheck.grapheneos.network/generate_204";
+ private static final String GRAPHENEOS_CAPTIVE_PORTAL_FALLBACK_URL =
+ "http://grapheneos.online/gen_204";
+ private static final String GRAPHENEOS_CAPTIVE_PORTAL_OTHER_FALLBACK_URL =
+ "http://grapheneos.online/generate_204";
+
+ // DivestOS
+ private static final String DIVESTOS_HTTPS_URL =
+ "https://divestos.org/generate_204";
+ private static final String DIVESTOS_HTTP_URL =
+ "http://divestos.org/generate_204";
+
+ // openSUSE
+ private static final String OPENSUSE_HTTPS_URL =
+ "https://conncheck.opensuse.org";
+ private static final String OPENSUSE_HTTP_URL =
+ "http://conncheck.opensuse.org";
+
+ // Ubuntu
+ private static final String UBUNTU_HTTPS_URL =
+ "https://connectivity-check.ubuntu.com";
+ private static final String UBUNTU_HTTP_URL =
+ "http://connectivity-check.ubuntu.com";
+
+ // Kuketz, https://www.kuketz-blog.de/android-captive-portal-check-204-http-antwort-von-captiveportal-kuketz-de/
+ private static final String KUKETZ_HTTPS_URL =
+ "https://captiveportal.kuketz.de";
+ private static final String KUKETZ_HTTP_URL =
+ "http://captiveportal.kuketz.de";
+
+ private static final int DISABLED_CAPTIVE_PORTAL_INTVAL = 0;
+ private static final int DIVESTOS_CAPTIVE_PORTAL_HTTP_URL_INTVAL = 1;
+ private static final int STANDARD_CAPTIVE_PORTAL_HTTP_URL_INTVAL = 2;
+ private static final int OPENSUSE_CAPTIVE_PORTAL_HTTP_URL_INTVAL = 3;
+ private static final int UBUNTU_CAPTIVE_PORTAL_HTTP_URL_INTVAL = 4;
+ private static final int GRAPHENEOS_CAPTIVE_PORTAL_HTTP_URL_INTVAL = 5;
+ private static final int KUKETZ_CAPTIVE_PORTAL_HTTP_URL_INTVAL = 6;
+
+ private static final String KEY_CONNECTIVITY_CHECK_SETTINGS =
+ "connectivity_check_settings";
+
+ private ListPreference mConnectivityPreference;
+
+ public ConnectivityCheckPreferenceController(Context context) {
+ super(context, KEY_CONNECTIVITY_CHECK_SETTINGS);
+ }
+
+ @Override
+ public int getAvailabilityStatus() {
+ if (isDisabledByAdmin()) {
+ return BasePreferenceController.DISABLED_FOR_USER;
+ }
+ return BasePreferenceController.AVAILABLE;
+ }
+
+ @Override
+ public void displayPreference(PreferenceScreen screen) {
+ ListPreference captiveList = new ListPreference(screen.getContext());
+ captiveList.setKey(KEY_CONNECTIVITY_CHECK_SETTINGS);
+ captiveList.setOrder(30);
+ captiveList.setIcon(R.drawable.ic_settings_language);
+ captiveList.setTitle(R.string.connectivity_check_title);
+ captiveList.setSummary(R.string.connectivity_check_summary);
+ captiveList.setEntries(R.array.connectivity_check_entries);
+ captiveList.setEntryValues(R.array.connectivity_check_values);
+
+ if (mConnectivityPreference == null) {
+ screen.addPreference(captiveList);
+ mConnectivityPreference = captiveList;
+ }
+ super.displayPreference(screen);
+ updatePreferenceState();
+ }
+
+ @Override
+ public String getPreferenceKey() {
+ return KEY_CONNECTIVITY_CHECK_SETTINGS;
+ }
+
+ private void updatePreferenceState() {
+ if (Settings.Global.getInt(mContext.getContentResolver(),
+ Settings.Global.CAPTIVE_PORTAL_MODE, Settings.Global.CAPTIVE_PORTAL_MODE_PROMPT)
+ == Settings.Global.CAPTIVE_PORTAL_MODE_IGNORE) {
+ mConnectivityPreference.setValueIndex(DISABLED_CAPTIVE_PORTAL_INTVAL);
+ return;
+ }
+
+ String pref = Settings.Global.getString(
+ mContext.getContentResolver(), Settings.Global.CAPTIVE_PORTAL_HTTP_URL);
+ if (STANDARD_HTTP_URL.equals(pref)) {
+ mConnectivityPreference.setValueIndex(
+ STANDARD_CAPTIVE_PORTAL_HTTP_URL_INTVAL);
+ } else if (GRAPHENEOS_CAPTIVE_PORTAL_HTTP_URL.equals(pref)) {
+ mConnectivityPreference.setValueIndex(
+ GRAPHENEOS_CAPTIVE_PORTAL_HTTP_URL_INTVAL);
+ } else if (DIVESTOS_HTTP_URL.equals(pref)) {
+ mConnectivityPreference.setValueIndex(
+ DIVESTOS_CAPTIVE_PORTAL_HTTP_URL_INTVAL);
+ } else if (OPENSUSE_HTTP_URL.equals(pref)) {
+ mConnectivityPreference.setValueIndex(
+ OPENSUSE_CAPTIVE_PORTAL_HTTP_URL_INTVAL);
+ } else if (UBUNTU_HTTP_URL.equals(pref)) {
+ mConnectivityPreference.setValueIndex(
+ UBUNTU_CAPTIVE_PORTAL_HTTP_URL_INTVAL);
+ } else if (KUKETZ_HTTP_URL.equals(pref)) {
+ mConnectivityPreference.setValueIndex(
+ KUKETZ_CAPTIVE_PORTAL_HTTP_URL_INTVAL);
+ }
+ }
+
+ @Override
+ public void onResume() {
+ updatePreferenceState();
+ if (mConnectivityPreference != null) {
+ setCaptivePortalURLs(
+ mContext.getContentResolver(),
+ Integer.parseInt(mConnectivityPreference.getValue()));
+ }
+ }
+
+ private void setCaptivePortalURLs(ContentResolver cr, int mode) {
+ switch (mode) {
+ case STANDARD_CAPTIVE_PORTAL_HTTP_URL_INTVAL:
+ Settings.Global.putString(cr, Settings.Global.CAPTIVE_PORTAL_HTTP_URL,
+ STANDARD_HTTP_URL);
+ Settings.Global.putString(cr, Settings.Global.CAPTIVE_PORTAL_HTTPS_URL,
+ STANDARD_HTTPS_URL);
+ Settings.Global.putString(cr, Settings.Global.CAPTIVE_PORTAL_FALLBACK_URL,
+ STANDARD_FALLBACK_URL);
+ Settings.Global.putString(
+ cr, Settings.Global.CAPTIVE_PORTAL_OTHER_FALLBACK_URLS,
+ STANDARD_OTHER_FALLBACK_URLS);
+ Settings.Global.putInt(cr, Settings.Global.CAPTIVE_PORTAL_MODE,
+ Settings.Global.CAPTIVE_PORTAL_MODE_PROMPT);
+ break;
+ case GRAPHENEOS_CAPTIVE_PORTAL_HTTP_URL_INTVAL:
+ Settings.Global.putString(cr, Settings.Global.CAPTIVE_PORTAL_HTTP_URL,
+ GRAPHENEOS_CAPTIVE_PORTAL_HTTP_URL);
+ Settings.Global.putString(cr, Settings.Global.CAPTIVE_PORTAL_HTTPS_URL,
+ GRAPHENEOS_CAPTIVE_PORTAL_HTTPS_URL);
+ Settings.Global.putString(cr, Settings.Global.CAPTIVE_PORTAL_FALLBACK_URL,
+ GRAPHENEOS_CAPTIVE_PORTAL_FALLBACK_URL);
+ Settings.Global.putString(
+ cr, Settings.Global.CAPTIVE_PORTAL_OTHER_FALLBACK_URLS,
+ GRAPHENEOS_CAPTIVE_PORTAL_OTHER_FALLBACK_URL);
+ Settings.Global.putInt(cr, Settings.Global.CAPTIVE_PORTAL_MODE,
+ Settings.Global.CAPTIVE_PORTAL_MODE_PROMPT);
+ break;
+ case DIVESTOS_CAPTIVE_PORTAL_HTTP_URL_INTVAL:
+ Settings.Global.putString(cr, Settings.Global.CAPTIVE_PORTAL_HTTP_URL,
+ DIVESTOS_HTTP_URL);
+ Settings.Global.putString(cr, Settings.Global.CAPTIVE_PORTAL_HTTPS_URL,
+ DIVESTOS_HTTPS_URL);
+ Settings.Global.putString(cr, Settings.Global.CAPTIVE_PORTAL_FALLBACK_URL,
+ DIVESTOS_HTTP_URL);
+ Settings.Global.putString(
+ cr, Settings.Global.CAPTIVE_PORTAL_OTHER_FALLBACK_URLS,
+ DIVESTOS_HTTP_URL);
+ Settings.Global.putInt(cr, Settings.Global.CAPTIVE_PORTAL_MODE,
+ Settings.Global.CAPTIVE_PORTAL_MODE_PROMPT);
+ break;
+ case OPENSUSE_CAPTIVE_PORTAL_HTTP_URL_INTVAL:
+ Settings.Global.putString(cr, Settings.Global.CAPTIVE_PORTAL_HTTP_URL,
+ OPENSUSE_HTTP_URL);
+ Settings.Global.putString(cr, Settings.Global.CAPTIVE_PORTAL_HTTPS_URL,
+ OPENSUSE_HTTPS_URL);
+ Settings.Global.putString(cr, Settings.Global.CAPTIVE_PORTAL_FALLBACK_URL,
+ OPENSUSE_HTTP_URL);
+ Settings.Global.putString(
+ cr, Settings.Global.CAPTIVE_PORTAL_OTHER_FALLBACK_URLS,
+ OPENSUSE_HTTP_URL);
+ Settings.Global.putInt(cr, Settings.Global.CAPTIVE_PORTAL_MODE,
+ Settings.Global.CAPTIVE_PORTAL_MODE_PROMPT);
+ break;
+ case UBUNTU_CAPTIVE_PORTAL_HTTP_URL_INTVAL:
+ Settings.Global.putString(cr, Settings.Global.CAPTIVE_PORTAL_HTTP_URL,
+ UBUNTU_HTTP_URL);
+ Settings.Global.putString(cr, Settings.Global.CAPTIVE_PORTAL_HTTPS_URL,
+ UBUNTU_HTTPS_URL);
+ Settings.Global.putString(cr, Settings.Global.CAPTIVE_PORTAL_FALLBACK_URL,
+ UBUNTU_HTTP_URL);
+ Settings.Global.putString(
+ cr, Settings.Global.CAPTIVE_PORTAL_OTHER_FALLBACK_URLS,
+ UBUNTU_HTTP_URL);
+ Settings.Global.putInt(cr, Settings.Global.CAPTIVE_PORTAL_MODE,
+ Settings.Global.CAPTIVE_PORTAL_MODE_PROMPT);
+ break;
+ case KUKETZ_CAPTIVE_PORTAL_HTTP_URL_INTVAL:
+ Settings.Global.putString(cr, Settings.Global.CAPTIVE_PORTAL_HTTP_URL,
+ KUKETZ_HTTP_URL);
+ Settings.Global.putString(cr, Settings.Global.CAPTIVE_PORTAL_HTTPS_URL,
+ KUKETZ_HTTPS_URL);
+ Settings.Global.putString(cr, Settings.Global.CAPTIVE_PORTAL_FALLBACK_URL,
+ KUKETZ_HTTP_URL);
+ Settings.Global.putString(
+ cr, Settings.Global.CAPTIVE_PORTAL_OTHER_FALLBACK_URLS,
+ KUKETZ_HTTP_URL);
+ Settings.Global.putInt(cr, Settings.Global.CAPTIVE_PORTAL_MODE,
+ Settings.Global.CAPTIVE_PORTAL_MODE_PROMPT);
+ break;
+ default:
+ // Default URLs as placeholder
+ Settings.Global.putString(cr, Settings.Global.CAPTIVE_PORTAL_HTTP_URL,
+ STANDARD_HTTP_URL);
+ Settings.Global.putString(cr, Settings.Global.CAPTIVE_PORTAL_HTTPS_URL,
+ STANDARD_HTTPS_URL);
+ Settings.Global.putString(cr, Settings.Global.CAPTIVE_PORTAL_FALLBACK_URL,
+ STANDARD_FALLBACK_URL);
+ Settings.Global.putString(
+ cr, Settings.Global.CAPTIVE_PORTAL_OTHER_FALLBACK_URLS,
+ STANDARD_OTHER_FALLBACK_URLS);
+ Settings.Global.putInt(cr, Settings.Global.CAPTIVE_PORTAL_MODE,
+ Settings.Global.CAPTIVE_PORTAL_MODE_IGNORE);
+ }
+ }
+
+ @Override
+ public boolean onPreferenceChange(Preference preference, Object value) {
+ final String key = preference.getKey();
+ if (KEY_CONNECTIVITY_CHECK_SETTINGS.equals(key)) {
+ setCaptivePortalURLs(mContext.getContentResolver(),
+ Integer.parseInt((String)value));
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ private EnforcedAdmin getEnforcedAdmin() {
+ return RestrictedLockUtilsInternal.checkIfRestrictionEnforced(
+ mContext, UserManager.DISALLOW_CONFIG_PRIVATE_DNS,
+ UserHandle.myUserId());
+ }
+
+ private boolean isDisabledByAdmin() { return getEnforcedAdmin() != null; }
+}
diff --git a/src/com/android/settings/network/NetworkDashboardFragment.java b/src/com/android/settings/network/NetworkDashboardFragment.java
index 4ea3464569..00daadb8dc 100644
--- a/src/com/android/settings/network/NetworkDashboardFragment.java
+++ b/src/com/android/settings/network/NetworkDashboardFragment.java
@@ -123,6 +123,9 @@ public class NetworkDashboardFragment extends DashboardFragment implements
}
controllers.add(privateDnsPreferenceController);
controllers.add(new NetworkProviderCallsSmsController(context, lifecycle, lifecycleOwner));
+ ConnectivityCheckPreferenceController connectivityCheck =
+ new ConnectivityCheckPreferenceController(context);
+ controllers.add(connectivityCheck);
// Start SettingsDumpService after the MobileNetworkRepository is created.
Intent intent = new Intent(context, SettingsDumpService.class);
diff --git a/src/com/android/settings/privacy/AdvancedPrivacyDashboardFragment.java b/src/com/android/settings/privacy/AdvancedPrivacyDashboardFragment.java
new file mode 100644
index 0000000000..c0564742c3
--- /dev/null
+++ b/src/com/android/settings/privacy/AdvancedPrivacyDashboardFragment.java
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2019-2022 ECORP SAS
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.settings.privacy;
+
+import android.app.Activity;
+import android.content.ComponentName;
+import android.content.Intent;
+import android.os.Bundle;
+
+import androidx.fragment.app.Fragment;
+
+import com.android.settings.R;
+import com.android.settings.search.BaseSearchIndexProvider;
+import com.android.settingslib.search.SearchIndexable;
+
+@SearchIndexable
+public class AdvancedPrivacyDashboardFragment extends Fragment {
+
+ private static final String advancedPrivacyPackageName = "foundation.e.advancedprivacy";
+ private static final String advancedPrivacyActivityName = "foundation.e.advancedprivacy.main.MainActivity";
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ Activity activity = getActivity();
+ Intent intent = new Intent().setComponent(new ComponentName(advancedPrivacyPackageName,
+ advancedPrivacyActivityName));
+ startActivity(intent);
+
+ if (activity != null) {
+ activity.finish();
+ }
+ }
+
+ public static final BaseSearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
+ new BaseSearchIndexProvider(R.xml.advanced_privacy_dashboard_settings);
+}
\ No newline at end of file
diff --git a/src/com/android/settings/wifi/WifiStatusTest.java b/src/com/android/settings/wifi/WifiStatusTest.java
index b4f3ab6ca4..3ca96f1c90 100644
--- a/src/com/android/settings/wifi/WifiStatusTest.java
+++ b/src/com/android/settings/wifi/WifiStatusTest.java
@@ -344,7 +344,7 @@ public class WifiStatusTest extends Activity {
private final void pingHostname() {
try {
// TODO: Hardcoded for now, make it UI configurable
- Process p = Runtime.getRuntime().exec("ping -c 1 -w 100 www.google.com");
+ Process p = Runtime.getRuntime().exec("ping -c 1 -w 100 leos-gsi.de");
int status = p.waitFor();
if (status == 0) {
mPingHostnameResult = "Pass";
@@ -364,7 +364,7 @@ public class WifiStatusTest extends Activity {
HttpURLConnection urlConnection = null;
try {
// TODO: Hardcoded for now, make it UI configurable
- URL url = new URL("https://www.google.com");
+ URL url = new URL("https://leos-gsi.de");
urlConnection = (HttpURLConnection) url.openConnection();
if (urlConnection.getResponseCode() == 200) {
mHttpClientTestResult = "Pass";
--
2.34.1

View File

@ -0,0 +1,156 @@
From 436f872cd2d42cf2ad1015eb921376cbe1eede1b Mon Sep 17 00:00:00 2001
From: harvey186 <harvey186@hotmail.com>
Date: Mon, 18 Dec 2023 11:59:34 +0100
Subject: [PATCH] Host toogle new
Change-Id: I30b1221f456bb0bb95966789724e292f5b3047b9
---
res/values/strings.xml | 3 +
res/xml/privacy_dashboard_settings.xml | 7 ++
.../security/HostsPreferenceController.java | 106 ++++++++++++++++++
.../settings/security/SecuritySettings.java | 1 +
4 files changed, 117 insertions(+)
create mode 100644 src/com/android/settings/security/HostsPreferenceController.java
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 69a03bd4f9..1f58bb9d62 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -752,6 +752,9 @@
<string name="security_settings_face_settings_require_confirmation">Always require confirmation</string>
<!-- When authenticating in apps, always require confirmation (e.g. confirm button) after a face is authenticated. [CHAR LIMIT=70] -->
<string name="security_settings_face_settings_require_confirmation_details">When using Face Unlock in apps, always require confirmation step</string>
+ <string name="hosts_disable_title">Disable DNS content blocker</string>
+ <string name="hosts_disable_summary">Disables use of the included /etc/hosts database for data collection and malware blocking.</string>
+
<!-- Button text in face settings which removes the user's face model from the device [CHAR LIMIT=40] -->
<string name="security_settings_face_settings_remove_face_model">Delete face model</string>
<!-- Button text in face settings which lets the user enroll their face [CHAR LIMIT=40] -->
diff --git a/src/com/android/settings/security/HostsPreferenceController.java b/src/com/android/settings/security/HostsPreferenceController.java
new file mode 100644
index 0000000000..d8af6d2649
--- /dev/null
+++ b/src/com/android/settings/security/HostsPreferenceController.java
@@ -0,0 +1,106 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License
+ */
+
+package com.android.settings.security;
+
+import android.content.Context;
+
+import android.os.UserHandle;
+import android.os.UserManager;
+import android.os.SystemProperties;
+
+import android.provider.Settings;
+
+import androidx.preference.Preference;
+import androidx.preference.PreferenceCategory;
+import androidx.preference.PreferenceGroup;
+import androidx.preference.PreferenceScreen;
+import androidx.preference.TwoStatePreference;
+import androidx.preference.SwitchPreference;
+
+import com.android.internal.widget.LockPatternUtils;
+import com.android.settings.core.PreferenceControllerMixin;
+import com.android.settingslib.core.AbstractPreferenceController;
+import com.android.settingslib.core.lifecycle.events.OnResume;
+
+public class HostsPreferenceController extends AbstractPreferenceController
+ implements PreferenceControllerMixin, OnResume, Preference.OnPreferenceChangeListener {
+
+ private static final String SYS_KEY_HOSTS_DISABLE = "persist.security.hosts_disable";
+ private static final String PREF_KEY_HOSTS_DISABLE = "hosts_disable";
+ private static final String PREF_KEY_SECURITY_CATEGORY = "security_category";
+
+ private PreferenceCategory mSecurityCategory;
+ private SwitchPreference mHostsDisable;
+ private boolean mIsAdmin;
+ private UserManager mUm;
+
+ public HostsPreferenceController(Context context) {
+ super(context);
+ mUm = UserManager.get(context);
+ }
+
+ @Override
+ public void displayPreference(PreferenceScreen screen) {
+ super.displayPreference(screen);
+ mSecurityCategory = screen.findPreference(PREF_KEY_SECURITY_CATEGORY);
+ updatePreferenceState();
+ }
+
+ @Override
+ public boolean isAvailable() {
+ mIsAdmin = mUm.isAdminUser();
+ return mIsAdmin;
+ }
+
+ @Override
+ public String getPreferenceKey() {
+ return PREF_KEY_HOSTS_DISABLE;
+ }
+
+ // TODO: should we use onCreatePreferences() instead?
+ private void updatePreferenceState() {
+ if (mSecurityCategory == null) {
+ return;
+ }
+
+ if (mIsAdmin) {
+ mHostsDisable = (SwitchPreference) mSecurityCategory.findPreference(PREF_KEY_HOSTS_DISABLE);
+ mHostsDisable.setChecked(SystemProperties.getInt(SYS_KEY_HOSTS_DISABLE, 0) == 1);
+ } else {
+ mSecurityCategory.removePreference(mSecurityCategory.findPreference(PREF_KEY_HOSTS_DISABLE));
+ }
+ }
+
+ @Override
+ public void onResume() {
+ updatePreferenceState();
+ if (mHostsDisable != null) {
+ boolean mode = mHostsDisable.isChecked();
+ SystemProperties.set(SYS_KEY_HOSTS_DISABLE, mode ? "1" : "0");
+ }
+ }
+
+ @Override
+ public boolean onPreferenceChange(Preference preference, Object value) {
+ final String key = preference.getKey();
+ if (PREF_KEY_HOSTS_DISABLE.equals(key)) {
+ final boolean mode = !mHostsDisable.isChecked();
+ SystemProperties.set(SYS_KEY_HOSTS_DISABLE, mode ? "1" : "0");
+ }
+ return true;
+ }
+}
diff --git a/src/com/android/settings/security/SecuritySettings.java b/src/com/android/settings/security/SecuritySettings.java
index b30b54d4d4..62eeaefd57 100644
--- a/src/com/android/settings/security/SecuritySettings.java
+++ b/src/com/android/settings/security/SecuritySettings.java
@@ -105,6 +105,7 @@ public class SecuritySettings extends DashboardFragment {
securityPreferenceControllers.add(new CombinedBiometricStatusPreferenceController(
context, lifecycle));
securityPreferenceControllers.add(new ChangeScreenLockPreferenceController(context, host));
+ securityPreferenceControllers.add(new HostsPreferenceController(context));
controllers.add(new PreferenceCategoryController(context, SECURITY_CATEGORY)
.setChildren(securityPreferenceControllers));
controllers.addAll(securityPreferenceControllers);
--
2.34.1

View File

@ -0,0 +1,32 @@
From 1da77885c43a2f95f427f0a30be648c63e505d64 Mon Sep 17 00:00:00 2001
From: harvey186 <harvey186@hotmail.com>
Date: Mon, 18 Dec 2023 12:38:03 +0100
Subject: [PATCH] Hosts_toogle_new_dev_options
Change-Id: I126c43dd2d011439591bf3f6ff1d718056359a86
---
res/xml/development_settings.xml | 7 ++
1 files changed, 163 insertions(+), 7 deletions(-)
diff --git a/res/xml/development_settings.xml b/res/xml/development_settings.xml
index 32acac66dd..ee433d1c34 100644
--- a/res/xml/development_settings.xml
+++ b/res/xml/development_settings.xml
@@ -28,6 +28,13 @@
android:title="@string/memory_settings_title"
android:summary="@string/summary_placeholder"
android:fragment="com.android.settings.applications.ProcessStatsSummary" />
+
+ <!-- Hosts toggle -->
+ <SwitchPreference
+ android:key="hosts_disable"
+ android:title="@string/hosts_disable_title"
+ android:summary="@string/hosts_disable_summary"
+ android:persistent="false" />
<com.android.settings.BugreportPreference
android:key="bugreport"
--
2.34.1

View File

@ -0,0 +1,105 @@
From 9609658665fdd38df5ac3cb5914a1bd0e8a21ec8 Mon Sep 17 00:00:00 2001
From: harvey186 <harvey186@hotmail.com>
Date: Sat, 15 Jul 2023 07:22:47 +0200
Subject: [PATCH] advanced_privacy
Change-Id: I9d72f49c548ec731411529f75b148f80680a3ee4
---
getaddrinfo.cpp | 67 +++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 67 insertions(+)
diff --git a/getaddrinfo.cpp b/getaddrinfo.cpp
index 4760f7f..8c9dcf8 100644
--- a/getaddrinfo.cpp
+++ b/getaddrinfo.cpp
@@ -3,6 +3,7 @@
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
+ * Copyright (C) 2021 ECORP
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -322,6 +323,66 @@ int validateHints(const addrinfo* _Nonnull hints) {
} // namespace
+int shouldBlockRequest(const char* hostname, int uid){
+ int sock, len;
+ struct sockaddr_un server;
+ char message[1000], server_reply[2000];
+
+ //Create socket
+ sock = socket(AF_UNIX, SOCK_STREAM | SOCK_CLOEXEC, 0);
+ if (sock == -1) {
+ LOG(DEBUG) << "Socket: Could not create socket";
+ }
+ LOG(DEBUG) << "Socket: created";
+
+ char const* name = "foundation.e.advancedprivacy";
+ int nameLen = strlen(name);
+ server.sun_path[0] = '\0'; /* abstract namespace */
+ strncpy(server.sun_path + 1, name, nameLen);
+ server.sun_family = AF_UNIX;
+ len = 1 + nameLen + offsetof(struct sockaddr_un, sun_path);
+
+ //Connect to remote server
+ if (connect(sock, (struct sockaddr *)&server, len) < 0) {
+ LOG(DEBUG) << "Socket: connect failed. Error";
+ close(sock);
+ return 0;
+ }
+
+ LOG(DEBUG) << "Socket: Connected";
+
+ //keep communicating with server
+ snprintf(message, sizeof(message), "%s,%d", hostname, uid);
+
+ //Send some data
+ if(send(sock, message, strlen(message), 0) < 0) {
+ LOG(DEBUG) << "Socket: Send failed";
+ close(sock);
+ return 0;
+ }
+ shutdown(sock, SHUT_WR);
+ //Receive a reply from the server
+ if (recv(sock, server_reply, 2000, 0) < 0) {
+ LOG(DEBUG) << "Socket:recv failed";
+ close(sock);
+ return 0;
+ }
+
+ LOG(DEBUG) << "Socket: Server reply : " << server_reply;
+ if (strncmp(server_reply, "pass", 4) == 0) {
+ LOG(DEBUG) << "Socket: Shouldn't block";
+ close(sock);
+ return 0;
+ } else {
+ LOG(DEBUG) << "Socket: should block";
+ close(sock);
+ return 1;
+ }
+ close(sock);
+ return 0;
+
+}
+
int android_getaddrinfofornetcontext(const char* hostname, const char* servname,
const addrinfo* hints, const android_net_context* netcontext,
addrinfo** res, NetworkDnsEventReported* event) {
@@ -415,6 +476,12 @@ int resolv_getaddrinfo(const char* _Nonnull hostname, const char* servname, cons
if (hostname == nullptr && servname == nullptr) return EAI_NONAME;
if (hostname == nullptr) return EAI_NODATA;
+ if (shouldBlockRequest(hostname, netcontext->uid)) {
+ char* dest = new char[10];
+ strncpy(dest, "localhost", strlen("localhost"));
+ hostname = dest;
+ }
+
// servname is allowed to be nullptr
// hints is allowed to be nullptr
assert(res != nullptr);
--
2.34.1

View File

@ -0,0 +1,73 @@
From 3765f3ba1c00635312be01ce80c9eed42a1cb3aa Mon Sep 17 00:00:00 2001
From: harvey186 <harvey186@hotmail.com>
Date: Tue, 19 Dec 2023 11:50:05 +0100
Subject: [PATCH] Random_MAC
Change-Id: Iaa5afb0222154907ab9b0f5c167ed770364965e2
---
src/android/net/dhcp/DhcpClient.java | 28 +++++++++++++++++++++++++++-
1 file changed, 27 insertions(+), 1 deletion(-)
diff --git a/src/android/net/dhcp/DhcpClient.java b/src/android/net/dhcp/DhcpClient.java
index 7ffd5002..f0ecb317 100644
--- a/src/android/net/dhcp/DhcpClient.java
+++ b/src/android/net/dhcp/DhcpClient.java
@@ -75,6 +75,9 @@ import android.net.metrics.IpConnectivityLog;
import android.net.networkstack.aidl.dhcp.DhcpOption;
import android.net.util.HostnameTransliterator;
import android.net.util.SocketUtils;
+import android.net.wifi.WifiConfiguration;
+import android.net.wifi.WifiInfo;
+import android.net.wifi.WifiManager;
import android.os.Build;
import android.os.Handler;
import android.os.Message;
@@ -117,6 +120,7 @@ import java.net.SocketAddress;
import java.net.SocketException;
import java.nio.ByteBuffer;
import java.util.Arrays;
+import java.util.ArrayList;
import java.util.List;
import java.util.Random;
@@ -1273,7 +1277,7 @@ public class DhcpClient extends StateMachine {
+ " lease expiry: " + attributes.assignedV4AddressExpiry
+ " current time: " + currentTime);
}
- if (currentTime >= attributes.assignedV4AddressExpiry) {
+ if (currentTime >= attributes.assignedV4AddressExpiry || shouldAvoidStateReuse()) {
// Lease has expired.
transitionTo(mDhcpInitState);
return HANDLED;
@@ -1306,6 +1310,28 @@ public class DhcpClient extends StateMachine {
transitionTo(mIpv6OnlyWaitState);
return true;
}
+ private static final int RANDOMIZATION_ALWAYS = 100;
+
+ private boolean shouldAvoidStateReuse() {
+ try {
+ WifiManager wifiManager = (WifiManager) mContext.getSystemService(Context.WIFI_SERVICE);
+ WifiInfo wifiInfo = wifiManager.getConnectionInfo();
+ if (wifiInfo != null) {
+ int connectedNetworkId = wifiInfo.getNetworkId();
+ List<WifiConfiguration> configurationList = wifiManager.getConfiguredNetworks();
+ for (WifiConfiguration configuration : configurationList){
+ if (configuration.networkId == connectedNetworkId){
+ return configuration.macRandomizationSetting == RANDOMIZATION_ALWAYS;
+ }
+ }
+ }
+ } catch (Exception e) {
+ loge(e.getLocalizedMessage(), e);
+ }
+
+ loge("ConfiguredNetworks should contain Connected network id config");
+ return true;
+ }
private void receiveOfferOrAckPacket(final DhcpPacket packet, final boolean acceptRapidCommit) {
if (!isValidPacket(packet)) return;
--
2.34.1

View File

@ -0,0 +1,56 @@
From 323bd70bb80ae86572bd2e3fa8d7791a6714bd57 Mon Sep 17 00:00:00 2001
From: harvey186 <harvey186@hotmail.com>
Date: Tue, 19 Dec 2023 13:06:08 +0100
Subject: [PATCH] Browser_No_Location
Change-Id: I83d0f10a46b982b0e78671021b2fa037febb2ba7
---
.../behavior/BrowserRoleBehavior.java | 27 -------------------
1 file changed, 27 deletions(-)
diff --git a/PermissionController/role-controller/java/com/android/role/controller/behavior/BrowserRoleBehavior.java b/PermissionController/role-controller/java/com/android/role/controller/behavior/BrowserRoleBehavior.java
index 2cf6a0b14..d6902753f 100644
--- a/PermissionController/role-controller/java/com/android/role/controller/behavior/BrowserRoleBehavior.java
+++ b/PermissionController/role-controller/java/com/android/role/controller/behavior/BrowserRoleBehavior.java
@@ -54,11 +54,6 @@ public class BrowserRoleBehavior implements RoleBehavior {
.addCategory(Intent.CATEGORY_BROWSABLE)
.setData(Uri.fromParts("http", "", null));
- private static final List<String> SYSTEM_BROWSER_PERMISSIONS = Arrays.asList(
- android.Manifest.permission.ACCESS_COARSE_LOCATION,
- android.Manifest.permission.ACCESS_FINE_LOCATION
- );
-
@Nullable
@Override
public String getFallbackHolder(@NonNull Role role, @NonNull Context context) {
@@ -131,26 +126,4 @@ public class BrowserRoleBehavior implements RoleBehavior {
}
return new ArrayList<>(packageNames);
}
-
- @Override
- public void grant(@NonNull Role role, @NonNull String packageName, @NonNull Context context) {
- // @see com.android.server.pm.permission.DefaultPermissionGrantPolicy
- // #grantDefaultPermissionsToDefaultBrowser(java.lang.String, int)
- if (SdkLevel.isAtLeastS()) {
- if (PackageUtils.isSystemPackage(packageName, context)) {
- Permissions.grant(packageName, SYSTEM_BROWSER_PERMISSIONS, false, false, true,
- false, false, context);
- }
- }
- }
-
- @Override
- public void revoke(@NonNull Role role, @NonNull String packageName, @NonNull Context context) {
- if (SdkLevel.isAtLeastT()) {
- if (PackageUtils.isSystemPackage(packageName, context)) {
- Permissions.revoke(packageName, SYSTEM_BROWSER_PERMISSIONS, true, false, false,
- context);
- }
- }
- }
}
--
2.34.1

View File

@ -0,0 +1,104 @@
From b859c277fbdfaec867f671c0a81fe973a66f954d Mon Sep 17 00:00:00 2001
From: harvey186 <harvey186@hotmail.com>
Date: Tue, 19 Dec 2023 11:49:18 +0100
Subject: [PATCH] Random_MAC
Change-Id: I4d36c2614db995153a4079a27e22d2351f6d47e0
---
framework/api/current.txt | 1 +
.../java/android/net/wifi/WifiConfiguration.java | 12 +++++++++---
.../com/android/server/wifi/WifiConfigManager.java | 6 +++++-
.../android/server/wifi/WifiConfigurationUtil.java | 2 +-
4 files changed, 16 insertions(+), 5 deletions(-)
diff --git a/framework/api/current.txt b/framework/api/current.txt
index abed5b1a93..e6a839a2f4 100644
--- a/framework/api/current.txt
+++ b/framework/api/current.txt
@@ -172,6 +172,7 @@ package android.net.wifi {
method public void writeToParcel(android.os.Parcel, int);
field @Deprecated public String BSSID;
field @Deprecated public String FQDN;
+ field @Deprecated public static final int RANDOMIZATION_ALWAYS = 100; // 0x64
field @Deprecated public static final int RANDOMIZATION_AUTO = 3; // 0x3
field @Deprecated public static final int RANDOMIZATION_NONE = 0; // 0x0
field @Deprecated public static final int RANDOMIZATION_NON_PERSISTENT = 2; // 0x2
diff --git a/framework/java/android/net/wifi/WifiConfiguration.java b/framework/java/android/net/wifi/WifiConfiguration.java
index 0bea151452..90e5bbba64 100644
--- a/framework/java/android/net/wifi/WifiConfiguration.java
+++ b/framework/java/android/net/wifi/WifiConfiguration.java
@@ -1793,7 +1793,8 @@ public class WifiConfiguration implements Parcelable {
RANDOMIZATION_NONE,
RANDOMIZATION_PERSISTENT,
RANDOMIZATION_NON_PERSISTENT,
- RANDOMIZATION_AUTO})
+ RANDOMIZATION_AUTO,
+ RANDOMIZATION_ALWAYS})
public @interface MacRandomizationSetting {}
/**
@@ -1816,17 +1817,22 @@ public class WifiConfiguration implements Parcelable {
* Let the wifi framework automatically decide the MAC randomization strategy.
*/
public static final int RANDOMIZATION_AUTO = 3;
+
+ /**
+ * Generate a randomize MAC always
+ */
+ public static final int RANDOMIZATION_ALWAYS = 100;
/**
* Level of MAC randomization for this network.
* One of {@link #RANDOMIZATION_NONE}, {@link #RANDOMIZATION_AUTO},
* {@link #RANDOMIZATION_PERSISTENT} or {@link #RANDOMIZATION_NON_PERSISTENT}.
- * By default this field is set to {@link #RANDOMIZATION_AUTO}.
+ * {@link #RANDOMIZATION_PERSISTENT} or {@link #RANDOMIZATION_NON_PERSISTENT} or RANDOMIZATION_ALWAYS.
* @hide
*/
@SystemApi
@MacRandomizationSetting
- public int macRandomizationSetting = RANDOMIZATION_AUTO;
+ public int macRandomizationSetting = RANDOMIZATION_ALWAYS;
/**
* Set the MAC randomization setting for this network.
diff --git a/service/java/com/android/server/wifi/WifiConfigManager.java b/service/java/com/android/server/wifi/WifiConfigManager.java
index 373efbe724..370ac3402b 100644
--- a/service/java/com/android/server/wifi/WifiConfigManager.java
+++ b/service/java/com/android/server/wifi/WifiConfigManager.java
@@ -466,6 +466,9 @@ public class WifiConfigManager {
* @return
*/
public boolean shouldUseNonPersistentRandomization(WifiConfiguration config) {
+ if (config.macRandomizationSetting == WifiConfiguration.RANDOMIZATION_ALWAYS) {
+ return true;
+ }
if (!isMacRandomizationSupported()
|| config.macRandomizationSetting == WifiConfiguration.RANDOMIZATION_NONE) {
return false;
@@ -615,7 +618,8 @@ public class WifiConfigManager {
private MacAddress updateRandomizedMacIfNeeded(WifiConfiguration config) {
boolean shouldUpdateMac = config.randomizedMacExpirationTimeMs
< mClock.getWallClockMillis() || mClock.getWallClockMillis()
- - config.randomizedMacLastModifiedTimeMs >= NON_PERSISTENT_MAC_REFRESH_MS_MAX;
+ - config.randomizedMacLastModifiedTimeMs >= NON_PERSISTENT_MAC_REFRESH_MS_MAX ||
+ config.macRandomizationSetting == WifiConfiguration.RANDOMIZATION_ALWAYS;
if (!shouldUpdateMac) {
return config.getRandomizedMacAddress();
}
diff --git a/service/java/com/android/server/wifi/WifiConfigurationUtil.java b/service/java/com/android/server/wifi/WifiConfigurationUtil.java
index d5de4191b0..95d1b377fb 100644
--- a/service/java/com/android/server/wifi/WifiConfigurationUtil.java
+++ b/service/java/com/android/server/wifi/WifiConfigurationUtil.java
@@ -258,7 +258,7 @@ public class WifiConfigurationUtil {
public static boolean hasMacRandomizationSettingsChanged(WifiConfiguration existingConfig,
WifiConfiguration newConfig) {
if (existingConfig == null) {
- return newConfig.macRandomizationSetting != WifiConfiguration.RANDOMIZATION_AUTO;
+ return newConfig.macRandomizationSetting != WifiConfiguration.RANDOMIZATION_ALWAYS;
}
return newConfig.macRandomizationSetting != existingConfig.macRandomizationSetting;
}
--
2.34.1

5
vendor/LeOS/leos.mk vendored
View File

@ -51,9 +51,8 @@ PRODUCT_PACKAGES += \
com.leos.contacts \
me.phh.superuser \
vendor.qti.qcril.am-V1.0-java \
# AdvancedPrivacy \
# Firewall \
# elib \
AdvancedPrivacy \
elib \
# Bootanimation