creation
|
@ -0,0 +1,339 @@
|
|||
/*
|
||||
* 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";
|
||||
|
||||
// Amazon Fire OS
|
||||
private static final String AMAZON_HTTPS_URL =
|
||||
"https://fireoscaptiveportal.com/generate_204";
|
||||
private static final String AMAZON_HTTP_URL =
|
||||
"http://fireoscaptiveportal.com/generate_204";
|
||||
|
||||
// Microsoft Edge
|
||||
private static final String MICROSOFT_HTTP_URL =
|
||||
"http://edge-http.microsoft.com/captiveportal/generate_204";
|
||||
|
||||
// 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 STANDARD_CAPTIVE_PORTAL_HTTP_URL_INTVAL = 1;
|
||||
private static final int GRAPHENEOS_CAPTIVE_PORTAL_HTTP_URL_INTVAL = 2;
|
||||
private static final int DIVESTOS_CAPTIVE_PORTAL_HTTP_URL_INTVAL = 3;
|
||||
private static final int OPENSUSE_CAPTIVE_PORTAL_HTTP_URL_INTVAL = 4;
|
||||
private static final int UBUNTU_CAPTIVE_PORTAL_HTTP_URL_INTVAL = 5;
|
||||
private static final int AMAZON_CAPTIVE_PORTAL_HTTP_URL_INTVAL = 6;
|
||||
private static final int MICROSOFT_CAPTIVE_PORTAL_HTTP_URL_INTVAL = 7;
|
||||
private static final int KUKETZ_CAPTIVE_PORTAL_HTTP_URL_INTVAL = 8;
|
||||
|
||||
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 (AMAZON_HTTP_URL.equals(pref)) {
|
||||
mConnectivityPreference.setValueIndex(
|
||||
AMAZON_CAPTIVE_PORTAL_HTTP_URL_INTVAL);
|
||||
} else if (MICROSOFT_HTTP_URL.equals(pref)) {
|
||||
mConnectivityPreference.setValueIndex(
|
||||
MICROSOFT_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 AMAZON_CAPTIVE_PORTAL_HTTP_URL_INTVAL:
|
||||
Settings.Global.putString(cr, Settings.Global.CAPTIVE_PORTAL_HTTP_URL,
|
||||
AMAZON_HTTP_URL);
|
||||
Settings.Global.putString(cr, Settings.Global.CAPTIVE_PORTAL_HTTPS_URL,
|
||||
AMAZON_HTTPS_URL);
|
||||
Settings.Global.putString(cr, Settings.Global.CAPTIVE_PORTAL_FALLBACK_URL,
|
||||
AMAZON_HTTP_URL);
|
||||
Settings.Global.putString(
|
||||
cr, Settings.Global.CAPTIVE_PORTAL_OTHER_FALLBACK_URLS,
|
||||
AMAZON_HTTP_URL);
|
||||
Settings.Global.putInt(cr, Settings.Global.CAPTIVE_PORTAL_MODE,
|
||||
Settings.Global.CAPTIVE_PORTAL_MODE_PROMPT);
|
||||
break;
|
||||
case MICROSOFT_CAPTIVE_PORTAL_HTTP_URL_INTVAL:
|
||||
Settings.Global.putString(cr, Settings.Global.CAPTIVE_PORTAL_HTTP_URL,
|
||||
MICROSOFT_HTTP_URL);
|
||||
Settings.Global.putString(cr, Settings.Global.CAPTIVE_PORTAL_HTTPS_URL,
|
||||
MICROSOFT_HTTP_URL);
|
||||
Settings.Global.putString(cr, Settings.Global.CAPTIVE_PORTAL_FALLBACK_URL,
|
||||
MICROSOFT_HTTP_URL);
|
||||
Settings.Global.putString(
|
||||
cr, Settings.Global.CAPTIVE_PORTAL_OTHER_FALLBACK_URLS,
|
||||
MICROSOFT_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; }
|
||||
}
|
|
@ -0,0 +1,522 @@
|
|||
/*
|
||||
* Copyright (C) 2020 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.
|
||||
*/
|
||||
|
||||
#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 <arpa/nameser.h>
|
||||
|
||||
#include "hostent.h"
|
||||
#include "resolv_private.h"
|
||||
|
||||
constexpr int MAXALIASES = 35;
|
||||
constexpr int MAXADDRS = 35;
|
||||
|
||||
#define MAX_ADDRLEN (INET6_ADDRSTRLEN - (1 + 5))
|
||||
#define MAX_HOSTLEN MAXHOSTNAMELEN
|
||||
|
||||
#define ESTIMATED_LINELEN 32
|
||||
#define HCFILE_ALLOC_SIZE 256
|
||||
|
||||
/* From sethostent.c */
|
||||
#define ALIGNBYTES (sizeof(uintptr_t) - 1)
|
||||
#define ALIGN(p) (((uintptr_t)(p) + ALIGNBYTES) &~ ALIGNBYTES)
|
||||
|
||||
/*
|
||||
* 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_CLOEXEC);
|
||||
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 = (char*)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 = (struct hcent*)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 = (const char*)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 = (struct hcent*)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 *name, 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;
|
||||
|
||||
if (!name)
|
||||
return EAI_SYSTEM;
|
||||
|
||||
pthread_mutex_lock(&hclock);
|
||||
|
||||
if (_hcfilemmap() != 0) {
|
||||
ret = EAI_SYSTEM;
|
||||
goto out;
|
||||
}
|
||||
ent = _hcfindname(name);
|
||||
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_numeric(addrstr, nullptr, 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);
|
||||
return ret;
|
||||
|
||||
nospc:
|
||||
ret = NETDB_INTERNAL;
|
||||
goto out;
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
/*
|
||||
* Copyright (C) 2020 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.
|
||||
*/
|
||||
|
||||
#ifndef NETD_RESOLV_HOSTS_CACHE_H
|
||||
#define NETD_RESOLV_HOSTS_CACHE_H
|
||||
|
||||
struct getnamaddr;
|
||||
|
||||
int hc_getaddrinfo(const char* name, const struct addrinfo* hints,
|
||||
struct addrinfo** result);
|
||||
|
||||
int hc_gethtbyname(const char *host, int af, struct getnamaddr *info);
|
||||
|
||||
#endif
|
|
@ -0,0 +1,21 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<manifest>
|
||||
<remote name="github" fetch="https://github.com" />
|
||||
<remote name="gitlab" fetch="https://gitlab.com" />
|
||||
|
||||
<!-- TrebleDroid -->
|
||||
<project name="TrebleDroid/device_phh_treble" path="device/phh/treble" remote="github" revision="android-14.0" />
|
||||
<project name="TrebleDroid/vendor_hardware_overlay" path="vendor/hardware_overlay" remote="github" revision="pie" />
|
||||
<project name="TrebleDroid/vendor_interfaces" path="vendor/interfaces" remote="github" revision="android-14.0" />
|
||||
<project name="TrebleDroid/treble_app" path="treble_app" remote="github" revision="master" />
|
||||
<project name="AndyCGYan/android_packages_apps_QcRilAm" path="packages/apps/QcRilAm" remote="github" revision="master" />
|
||||
<project name="platform/prebuilts/vndk/v28" path="prebuilts/vndk/v28" remote="aosp" revision="204f1bad00aaf480ba33233f7b8c2ddaa03155dd" clone-depth="1" />
|
||||
|
||||
<!-- ponces -->
|
||||
<project name="ponces/vendor_ponces" path="vendor/ponces" remote="github" revision="android-14.0" />
|
||||
<project name="ponces/treble_adapter" path="treble_adapter" remote="github" revision="master" />
|
||||
<project name="ponces/packages_apps_ParanoidSense" path="packages/apps/ParanoidSense" remote="github" revision="uvite" />
|
||||
|
||||
<project name="ponces/android_packages_apps_Trebuchet" path="packages/apps/Trebuchet" remote="github" revision="lineage-21.0-ponces" />
|
||||
<project name="LineageOS/android_packages_apps_ThemePicker" path="packages/apps/ThemePicker" remote="github" revision="lineage-21.0" />
|
||||
</manifest>
|
|
@ -0,0 +1,105 @@
|
|||
/*
|
||||
* 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;
|
||||
}
|
||||
}
|
After Width: | Height: | Size: 41 KiB |
|
@ -0,0 +1,24 @@
|
|||
START=`date +%s`
|
||||
export RELAX_USES_LIBRARY_CHECK=true
|
||||
export USE_CCACHE=1
|
||||
export CCACHE_SIZE=100G
|
||||
echo "ready to build"
|
||||
|
||||
cp update.sh prebuilts/prebuiltapks/foss_nano
|
||||
cd prebuilts/prebuiltapks/foss_nano
|
||||
bash update.sh
|
||||
cd ../../..
|
||||
|
||||
source build/envsetup.sh
|
||||
export WITHOUT_CHECK_API=true
|
||||
|
||||
lunch lineage_a64_bvN-userdebug
|
||||
|
||||
make installclean
|
||||
make -j4 systemimage
|
||||
make vndk-test-sepolicy
|
||||
cp $OUT/system.img images/LeOS-19.1-VNDK-a64-bvN.img
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
START=`date +%s`
|
||||
export RELAX_USES_LIBRARY_CHECK=true
|
||||
export USE_CCACHE=1
|
||||
export CCACHE_SIZE=100G
|
||||
echo "ready to build"
|
||||
|
||||
cp updateS.sh prebuilts/prebuiltapks/foss_nano
|
||||
cd prebuilts/prebuiltapks/foss_nano
|
||||
bash updateS.sh
|
||||
cd ../../..
|
||||
|
||||
source build/envsetup.sh
|
||||
export WITHOUT_CHECK_API=true
|
||||
export WITH_SU=true
|
||||
|
||||
lunch lineage_a64_bvS-userdebug
|
||||
|
||||
make installclean
|
||||
make -j4 systemimage
|
||||
make vndk-test-sepolicy
|
||||
|
||||
############# sas-creator call ##############
|
||||
cd sas-creator/
|
||||
sudo bash lite-adapterSa64.sh 32 system.img
|
||||
######################################
|
||||
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
|
||||
echo 'Start building'
|
||||
bash arm64S.sh
|
||||
bash a64S.sh
|
||||
bash arm64N.sh
|
||||
bash a64.sh
|
After Width: | Height: | Size: 52 KiB |
After Width: | Height: | Size: 16 KiB |
After Width: | Height: | Size: 32 KiB |
After Width: | Height: | Size: 16 KiB |
After Width: | Height: | Size: 2.6 KiB |
After Width: | Height: | Size: 61 KiB |
|
@ -0,0 +1,24 @@
|
|||
START=`date +%s`
|
||||
export RELAX_USES_LIBRARY_CHECK=true
|
||||
export USE_CCACHE=1
|
||||
export CCACHE_SIZE=50G
|
||||
echo "ready to build"
|
||||
|
||||
cp update.sh prebuilts/prebuiltapks/foss_nano
|
||||
cd prebuilts/prebuiltapks/foss_nano
|
||||
bash update.sh
|
||||
cd ../../..
|
||||
|
||||
|
||||
source build/envsetup.sh
|
||||
export WITHOUT_CHECK_API=true
|
||||
|
||||
lunch lineage_arm64_bvN-userdebug
|
||||
|
||||
make installclean
|
||||
make -j4 systemimage
|
||||
make vndk-test-sepolicy
|
||||
cp $OUT/system.img images/LeOS-19.1-VNDK-arm64-bvN.img
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
START=`date +%s`
|
||||
export RELAX_USES_LIBRARY_CHECK=true
|
||||
export USE_CCACHE=1
|
||||
export CCACHE_SIZE=100G
|
||||
echo "ready to build"
|
||||
|
||||
cp updateS.sh prebuilts/prebuiltapks/foss_nano
|
||||
cd prebuilts/prebuiltapks/foss_nano
|
||||
bash updateS.sh
|
||||
cd ../../..
|
||||
|
||||
source build/envsetup.sh
|
||||
export WITHOUT_CHECK_API=true
|
||||
export WITH_SU=true
|
||||
|
||||
lunch lineage_arm64_bvS-userdebug
|
||||
|
||||
make installclean
|
||||
make -j4 systemimage
|
||||
make vndk-test-sepolicy
|
||||
|
||||
############# sas-creator call ##############
|
||||
cd sas-creator
|
||||
sudo bash lite-adapterS.sh 64 system.img
|
||||
######################################
|
||||
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
diff --git a/buildbot_unified.sh b/buildbot_unified.sh
|
||||
index b2c569f..3200753 100755
|
||||
--- a/buildbot_unified.sh
|
||||
+++ b/buildbot_unified.sh
|
||||
@@ -48,10 +48,10 @@ START=`date +%s`
|
||||
BUILD_DATE="$(date +%Y%m%d)"
|
||||
|
||||
prep_build() {
|
||||
- echo "Preparing local manifests"
|
||||
- mkdir -p .repo/local_manifests
|
||||
- cp ./lineage_build_unified/local_manifests_${MODE}/*.xml .repo/local_manifests
|
||||
- echo ""
|
||||
+# echo "Preparing local manifests"
|
||||
+# mkdir -p .repo/local_manifests
|
||||
+# cp ./lineage_build_unified/local_manifests_${MODE}/*.xml .repo/local_manifests
|
||||
+# echo ""
|
||||
|
||||
echo "Syncing repos"
|
||||
repo sync -c --force-sync --no-clone-bundle --no-tags -j$(nproc --all)
|
||||
@@ -120,6 +120,7 @@ build_treble() {
|
||||
(*) echo "Invalid target - exiting"; exit 1;;
|
||||
esac
|
||||
lunch lineage_${TARGET}-userdebug
|
||||
+ exit
|
||||
make installclean
|
||||
make -j$(nproc --all) systemimage
|
||||
mv $OUT/system.img ~/build-output/lineage-19.1-$BUILD_DATE-UNOFFICIAL-${TARGET}$(${PERSONAL} && echo "-personal" || echo "").img
|
|
@ -0,0 +1,141 @@
|
|||
#!/bin/bash
|
||||
git clone https://github.com/AndyCGYan/lineage_build_unified lineage_build_unified -b lineage-19.1
|
||||
git clone https://github.com/AndyCGYan/lineage_patches_unified lineage_patches_unified -b lineage-19.1
|
||||
|
||||
echo 'patch build bot and run it'
|
||||
cp LeOS/bot.patch lineage_build_unified/
|
||||
cd lineage_build_unified
|
||||
git apply bot.patch
|
||||
cd ..
|
||||
bash lineage_build_unified/buildbot_unified.sh treble 64B
|
||||
|
||||
mkdir images
|
||||
|
||||
echo 'Bootanimation'
|
||||
cp LeOS/android-logo-mask1a.png frameworks/base/core/res/assets/images/android-logo-mask.png
|
||||
cp LeOS/android-logo-shine.png frameworks/base/core/res/assets/images/android-logo-shine.png
|
||||
rm device/phh/treble/bootanimation.zip
|
||||
rm -R vendor/lineage/bootanimation/
|
||||
rm device/phh/treble/phh.mk
|
||||
|
||||
|
||||
echo 'background'
|
||||
cp LeOS/default_wallpaper.png frameworks/base/core/res/res/drawable-nodpi/default_wallpaper.png
|
||||
cp LeOS/default_wallpaper.png frameworks/base/core/res/res/drawable-sw600dp-nodpi/default_wallpaper.png
|
||||
cp LeOS/default_wallpaper.png frameworks/base/core/res/res/drawable-sw720dp-nodpi/default_wallpaper.png
|
||||
cp LeOS/default_wallpaper.png frameworks/base/tests/HwAccelerationTest/res/drawable/default_wallpaper.png
|
||||
rm -R vendor/lineage/overlay/common/frameworks/base/core/res/res/drawable*
|
||||
|
||||
echo 'Fonts'
|
||||
cp LeOS/Roboto-Regular.ttf external/roboto-fonts/
|
||||
cp LeOS/RobotoStatic-Regular.ttf external/roboto-fonts/
|
||||
|
||||
echo 'EasterEgg'
|
||||
rm -R frameworks/base/packages/EasterEgg
|
||||
|
||||
echo 'remove apps'
|
||||
rm -R packages/apps/AudioFX
|
||||
rm -R packages/apps/Eleven
|
||||
rm -R packages/apps/Camera2
|
||||
rm -R packages/apps/Contacts
|
||||
rm -R packages/apps/DeskClock
|
||||
rm -R packages/apps/Etar
|
||||
rm -R packages/apps/Dialer
|
||||
rm -R packages/apps/ExactCalculator
|
||||
rm -R packages/apps/Gallery2
|
||||
rm -R packages/apps/FlipFlap
|
||||
rm -R packages/apps/Messaging
|
||||
rm -R packages/apps/Jelly
|
||||
rm -R vendor/partner_gms/
|
||||
rm -R packages/apps/UniversalMediaPlayer
|
||||
rm -R packages/apps/HTMLViewer
|
||||
rm -R packages/apps/Recorder
|
||||
rm -R packages/apps/ImsServiceEntitlement/src/com/android/imsserviceentitlement/fcm
|
||||
|
||||
echo 'LeOS apps'
|
||||
tar -xf LeOS/prebuiltapks.tar.xz -C prebuilts/
|
||||
|
||||
echo 'webview'
|
||||
tar -xf LeOS/bromite-webview.tar.xz -C external
|
||||
cd external/bromite-webview
|
||||
bash update.sh
|
||||
cd ../..
|
||||
|
||||
echo 'a-gps'
|
||||
cd vendor/hardware_overlay
|
||||
grep -RiIl 'supl.three.com' | xargs sed -i 's/supl.three.com/supl.three.com/g'
|
||||
cd ../..
|
||||
|
||||
echo 'hosts'
|
||||
cp LeOS/hosts system/core/rootdir/etc/
|
||||
|
||||
echo 'firebase mods'
|
||||
cp LeOS/firebase-messaging-21.0.1.aar external/firebase-messaging/libs/
|
||||
cp LeOS/play-services-cloud-messaging-16.0.0.aar external/firebase-messaging/libs/
|
||||
|
||||
echo 'overlays'
|
||||
tar -xf LeOS/overlay.tar.xz -C vendor
|
||||
cp LeOS/vendor_hardware-overlay.patch vendor/hardware_overlay
|
||||
cd vendor/hardware_overlay
|
||||
git apply *.patch
|
||||
cd ../..
|
||||
|
||||
echo 'encoder'
|
||||
mkdir vendor/LeOS
|
||||
tar -xf LeOS/encoder.tar.xz -C vendor/LeOS
|
||||
|
||||
echo 'sas-creator'
|
||||
tar -xf LeOS/sas-creator.tar.xz -C .
|
||||
|
||||
echo 'scripts'
|
||||
tar -xf LeOS/scripts.tar.xz -C .
|
||||
cp LeOS/leos.mk device/phh/treble
|
||||
|
||||
cp LeOS/leos.mk device/phh/treble
|
||||
|
||||
echo 'Patches'
|
||||
tar -xf LeOS/patches.tar.xz
|
||||
bash patches/apply.sh leos
|
||||
|
||||
cp LeOS/platform_testing.patch platform_testing/
|
||||
cd platform_testing/
|
||||
git apply *.patch
|
||||
cd ..
|
||||
|
||||
echo 'generate Scripts'
|
||||
cd device/phh/treble
|
||||
bash generate.sh lineage
|
||||
cd ../../../
|
||||
|
||||
echo 'Texte'
|
||||
cp LeOS/texte.sh .
|
||||
bash texte.sh
|
||||
rm texte.sh
|
||||
|
||||
export RELAX_USES_LIBRARY_CHECK=true
|
||||
|
||||
bash arm64S.sh
|
||||
|
||||
mv sas-creator/*.img images
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
After Width: | Height: | Size: 241 KiB |
|
@ -0,0 +1,5 @@
|
|||
fastboot reboot fastboot
|
||||
|
||||
fastboot flash system system.img
|
||||
|
||||
fastboot reboot
|
|
@ -0,0 +1,547 @@
|
|||
/*
|
||||
* 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_exact(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;
|
||||
}
|
||||
|
||||
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.
|
||||
*
|
||||
* 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;
|
||||
}
|
|
@ -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);
|
|
@ -0,0 +1,55 @@
|
|||
#prebuilts
|
||||
PRODUCT_PACKAGES += \
|
||||
me.phh.superuser \
|
||||
com.menny.android.anysoftkeyboard \
|
||||
com.qualcomm.location \
|
||||
com.aurora.services \
|
||||
org.fdroid.fdroid.privileged \
|
||||
org.bromite-webview \
|
||||
com.paranoid.ParanoidWallpapers \
|
||||
GmsCore \
|
||||
GsfProxy \
|
||||
FakeStore \
|
||||
com.google.android.maps.jar \
|
||||
AuroraServices \
|
||||
FDroidPrivilegedExtension \
|
||||
MozillaNlpBackend \
|
||||
NominatimNlpBackend \
|
||||
BrowserWebView \
|
||||
eSpeakTTS \
|
||||
Launcher \
|
||||
com.saggitt.omega \
|
||||
omega \
|
||||
Dialer \
|
||||
Seedvault \
|
||||
bromite-webview \
|
||||
FileManager \
|
||||
LeOS-Droid \
|
||||
DocumentsUI \
|
||||
Wallpaper \
|
||||
TrebleApp \
|
||||
Camera \
|
||||
OpenEUICC \
|
||||
Contacts \
|
||||
|
||||
|
||||
#### aptX files LeOS Changes
|
||||
#PRODUCT_COPY_FILES += \
|
||||
# vendor/LeOS/libaptX_encoder.so:system/lib64/libaptX_encoder.so \
|
||||
# vendor/LeOS/libaptXHD_encoder.so:system/lib64/libaptXHD_encoder.so \
|
||||
# vendor/LeOS/libaptX_encoder32.so:system/lib/libaptX_encoder.so \
|
||||
# vendor/LeOS/libaptXHD_encoder32.so:system/lib/libaptXHD_encoder.so \
|
||||
# vendor/LeOS/libperipheral_client.so:system/lib64/libperipheral_client.so \
|
||||
|
||||
|
||||
PRODUCT_PROPERTY_OVERRIDES += \
|
||||
AndroidBlackThemeOverlay=true \
|
||||
org.lineageos.overlay.customization.blacktheme=true \
|
||||
com.android.system.theme.black=true
|
||||
|
||||
PRODUCT_SYSTEM_DEFAULT_PROPERTIES += \
|
||||
Settings.Secure.UI_NIGHT_MODE=2
|
||||
|
||||
PRODUCT_PACKAGES += \
|
||||
bootanimation.zip
|
||||
|
|
@ -0,0 +1,70 @@
|
|||
#prebuilts
|
||||
PRODUCT_PACKAGES += \
|
||||
me.phh.superuser \
|
||||
com.menny.android.anysoftkeyboard \
|
||||
com.qualcomm.location \
|
||||
com.aurora.services \
|
||||
org.fdroid.fdroid.privileged \
|
||||
org.bromite-webview \
|
||||
com.paranoid.ParanoidWallpapers \
|
||||
GmsCore \
|
||||
GsfProxy \
|
||||
FakeStore \
|
||||
com.google.android.maps.jar \
|
||||
AuroraServices \
|
||||
FDroidPrivilegedExtension \
|
||||
MozillaNlpBackend \
|
||||
NominatimNlpBackend \
|
||||
gcamphotospreview-common \
|
||||
eSpeakTTS \
|
||||
Launcher \
|
||||
com.saggitt.omega \
|
||||
omega \
|
||||
Dialer \
|
||||
Seedvault \
|
||||
bromite-webview \
|
||||
FileManager \
|
||||
LeOS-Droid \
|
||||
DocumentsUI \
|
||||
Wallpaper \
|
||||
TrebleApp \
|
||||
SettingsIntelligence \
|
||||
OpenEUICC \
|
||||
Contacts \
|
||||
LineageSetupWizard \
|
||||
LineageBlackTheme \
|
||||
GCamPhotosPreview \
|
||||
com.leos.icons \
|
||||
LeOS-Icons \
|
||||
LeOS-Contacts \
|
||||
LeOS-Phone \
|
||||
com.goodwy.contacts \
|
||||
com.goodwy.dialer \
|
||||
ruffy \
|
||||
org.monkey.d.ruffy.ruffy \
|
||||
com.eveningoutpost.dexdrip \
|
||||
xdrip \
|
||||
|
||||
|
||||
|
||||
#### aptX files LeOS Changes
|
||||
PRODUCT_COPY_FILES += \
|
||||
vendor/LeOS/libaptX_encoder.so:system/lib64/libaptX_encoder.so \
|
||||
vendor/LeOS/libaptXHD_encoder.so:system/lib64/libaptXHD_encoder.so \
|
||||
vendor/LeOS/libaptX_encoder32.so:system/lib/libaptX_encoder.so \
|
||||
vendor/LeOS/libaptXHD_encoder32.so:system/lib/libaptXHD_encoder.so \
|
||||
vendor/LeOS/libperipheral_client.so:system/lib64/libperipheral_client.so \
|
||||
|
||||
|
||||
# Themes
|
||||
PRODUCT_PACKAGES += \
|
||||
LineageBlackTheme \
|
||||
|
||||
PRODUCT_PROPERTY_OVERRIDES += \
|
||||
AndroidBlackThemeOverlay=true \
|
||||
org.lineageos.overlay.customization.blacktheme=true \
|
||||
com.android.system.theme.black=true
|
||||
|
||||
PRODUCT_SYSTEM_DEFAULT_PROPERTIES += \
|
||||
Settings.Secure.UI_NIGHT_MODE=2
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<manifest>
|
||||
<project name="phhusson/vendor_hardware_overlay" path="vendor/hardware_overlay" remote="github" revision="pie" />
|
||||
<project name="phhusson/device_phh_treble" path="device/phh/treble" remote="github" revision="android-12.0" />
|
||||
<project name="phhusson/vendor_vndk-tests" path="vendor/vndk-tests" remote="github" revision="master" />
|
||||
<project name="phhusson/vendor_interfaces" path="vendor/interfaces" remote="github" revision="android-11.0" />
|
||||
<project name="phhusson/vendor_lptools" path="vendor/lptools" remote="github" revision="master" />
|
||||
<project name="phhusson/vendor_magisk" path="vendor/magisk" remote="github" revision="android-10.0" />
|
||||
</manifest>
|
|
@ -0,0 +1,125 @@
|
|||
platform_tests += \
|
||||
ActivityManagerPerfTests \
|
||||
ActivityManagerPerfTestsStubApp1 \
|
||||
ActivityManagerPerfTestsStubApp2 \
|
||||
ActivityManagerPerfTestsStubApp3 \
|
||||
ActivityManagerPerfTestsTestApp \
|
||||
AdServicesScenarioTests \
|
||||
AndroidTVJankTests \
|
||||
AndroidXComposeStartupApp \
|
||||
ApiDemos \
|
||||
AppCompatibilityTest \
|
||||
AppLaunch \
|
||||
AppTransitionTests \
|
||||
AutoLocTestApp \
|
||||
AutoLocVersionedTestApp_v1 \
|
||||
AutoLocVersionedTestApp_v2 \
|
||||
BackgroundDexOptServiceIntegrationTests \
|
||||
BandwidthEnforcementTest \
|
||||
BandwidthTests \
|
||||
BootHelperApp \
|
||||
BusinessCard \
|
||||
CalculatorFunctionalTests \
|
||||
camera_client_test \
|
||||
camera_metadata_tests \
|
||||
CellBroadcastReceiverTests \
|
||||
ConnectivityManagerTest \
|
||||
ContactsTests \
|
||||
CtsCameraTestCases \
|
||||
CtsHardwareTestCases \
|
||||
DataIdleTest \
|
||||
Development \
|
||||
DeviceHealthChecks \
|
||||
DynamicCodeLoggerIntegrationTests \
|
||||
DialerJankTests \
|
||||
DownloadManagerTestApp \
|
||||
StubIME \
|
||||
ExternalLocAllPermsTestApp \
|
||||
ExternalLocTestApp \
|
||||
ExternalLocVersionedTestApp_v1 \
|
||||
ExternalLocVersionedTestApp_v2 \
|
||||
ExternalSharedPermsBTTestApp \
|
||||
ExternalSharedPermsDiffKeyTestApp \
|
||||
ExternalSharedPermsFLTestApp \
|
||||
ExternalSharedPermsTestApp \
|
||||
flatland \
|
||||
FrameworkPerf \
|
||||
FrameworkPermissionTests \
|
||||
FrameworksCoreTests \
|
||||
FrameworksMockingCoreTests \
|
||||
FrameworksPrivacyLibraryTests \
|
||||
FrameworksUtilTests \
|
||||
InternalLocTestApp \
|
||||
JankMicroBenchmarkTests \
|
||||
LauncherIconsApp \
|
||||
long_trace_binder_config.textproto \
|
||||
long_trace_config.textproto \
|
||||
MemoryUsage \
|
||||
MultiDexLegacyTestApp \
|
||||
MultiDexLegacyTestApp2 \
|
||||
MultiDexLegacyTestServices \
|
||||
MultiDexLegacyTestServicesTests \
|
||||
MultiDexLegacyVersionedTestApp_v1 \
|
||||
MultiDexLegacyVersionedTestApp_v2 \
|
||||
MultiDexLegacyVersionedTestApp_v3 \
|
||||
NoLocTestApp \
|
||||
NoLocVersionedTestApp_v1 \
|
||||
NoLocVersionedTestApp_v2 \
|
||||
NotificationFunctionalTests \
|
||||
OverviewFunctionalTests \
|
||||
perfetto_trace_processor_shell \
|
||||
PerformanceAppTest \
|
||||
PerformanceLaunch \
|
||||
PermissionFunctionalTests \
|
||||
PermissionTestAppMV1 \
|
||||
PermissionUtils \
|
||||
PlatformCommonScenarioTests \
|
||||
PowerPerfTest \
|
||||
SdkSandboxPerfScenarioTests \
|
||||
SettingsUITests \
|
||||
SimpleServiceTestApp1 \
|
||||
SimpleServiceTestApp2 \
|
||||
SimpleServiceTestApp3 \
|
||||
SimpleTestApp \
|
||||
skia_dm \
|
||||
skia_nanobench \
|
||||
sl4a \
|
||||
SmokeTest \
|
||||
SmokeTestApp \
|
||||
SysAppJankTestsWear \
|
||||
TouchLatencyJankTestWear \
|
||||
trace_config.textproto \
|
||||
trace_config_detailed.textproto \
|
||||
trace_config_experimental.textproto \
|
||||
trace_config_multi_user_cuj_tests.textproto \
|
||||
UbSystemUiJankTests \
|
||||
UbWebViewJankTests \
|
||||
UiBench \
|
||||
UiBenchJankTests \
|
||||
UiBenchJankTestsWear \
|
||||
UiBenchMicrobenchmark \
|
||||
UpdateExternalLocTestApp_v1_ext \
|
||||
UpdateExternalLocTestApp_v2_none \
|
||||
UpdateExtToIntLocTestApp_v1_ext \
|
||||
UpdateExtToIntLocTestApp_v2_int \
|
||||
uwb_snippet \
|
||||
VersatileTestApp_Auto \
|
||||
VersatileTestApp_External \
|
||||
VersatileTestApp_Internal \
|
||||
VersatileTestApp_None \
|
||||
VoiceInteraction \
|
||||
WifiStrengthScannerUtil \
|
||||
|
||||
ifneq ($(strip $(BOARD_PERFSETUP_SCRIPT)),)
|
||||
platform_tests += perf-setup
|
||||
endif
|
||||
|
||||
ifneq ($(filter vsoc_arm vsoc_arm64 vsoc_x86 vsoc_x86_64, $(TARGET_BOARD_PLATFORM)),)
|
||||
platform_tests += \
|
||||
CuttlefishRilTests \
|
||||
CuttlefishWifiTests
|
||||
endif
|
||||
|
||||
ifeq ($(HOST_OS),linux)
|
||||
platform_tests += root-canal
|
||||
endif
|
|
@ -0,0 +1,17 @@
|
|||
diff --git a/build/tasks/tests/platform_test_list.mk b/build/tasks/tests/platform_test_list.mk
|
||||
index 74db4e00..b636767a 100644
|
||||
--- a/build/tasks/tests/platform_test_list.mk
|
||||
+++ b/build/tasks/tests/platform_test_list.mk
|
||||
@@ -21,12 +21,10 @@ platform_tests += \
|
||||
BootHelperApp \
|
||||
BusinessCard \
|
||||
CalculatorFunctionalTests \
|
||||
- CalendarTests \
|
||||
camera_client_test \
|
||||
camera_metadata_tests \
|
||||
CellBroadcastReceiverTests \
|
||||
ConnectivityManagerTest \
|
||||
- ContactsTests \
|
||||
CtsCameraTestCases \
|
||||
CtsHardwareTestCases \
|
||||
DataIdleTest \
|
|
@ -0,0 +1,20 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<manifest>
|
||||
<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"/>
|
||||
|
||||
|
||||
<remove-project name="platform/packages/apps/Settings" />
|
||||
<remove-project name="platform/packages/apps/SettingsIntelligence" />
|
||||
<remove-project name="platform/packages/modules/Permission" />
|
||||
|
||||
<project name="e/os/android_packages_modules_Permission" path="packages/modules/Permission" remote="e" revision="8ed2b55aca4fff615e91e8583d37e15a668f0520" upstream="refs/heads/v1-t" dest-branch="refs/heads/v1-t" groups="pdk-cw-fs,pdk-fs"/>
|
||||
<project name="e/os/android_packages_apps_Settings" path="packages/apps/Settings" remote="e" revision="a616a3b8b9cc74b4a7e8227bef515fe5daa57257" upstream="refs/heads/v1-t" dest-branch="refs/heads/v1-t" groups="pdk-fs"/>
|
||||
<project name="e/os/android_packages_apps_SettingsIntelligence" path="packages/apps/SettingsIntelligence" remote="e" revision="39ae44727498552e935e7fc4563edd2334edea3e" upstream="refs/heads/v1-t" dest-branch="refs/heads/v1-t" groups="pdk-fs"/>
|
||||
<project name="e/os/android_packages_services_SplitInstallService" path="packages/services/SplitInstallService" remote="e" revision="c0ba5a55a9ddc09ab094d7426b4a2520954f0f0c" upstream="main" dest-branch="main"/>
|
||||
<project name="e/os/android_vendor_eos" path="vendor/eos" remote="e" revision="fa261dad0c83503f54c5a216c7346b494fda67ec" upstream="refs/heads/v1-t" dest-branch="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"/>
|
||||
<project name="e/os/android_device_lineage_sepolicy" path="device/lineage/sepolicy" remote="e" revision="e6926da68d4e06e246ceffb1fdd5dafc978fd53e" upstream="refs/heads/v1-t" dest-branch="refs/heads/v1-t"/>
|
||||
</manifest>
|
|
@ -0,0 +1,26 @@
|
|||
#!/bin/bash
|
||||
echo 'Texte'
|
||||
cd packages/apps/Settings/res
|
||||
find -name \strings.xml |xargs -I{} xmlstarlet ed -L -u '//string[@msgid="6363561029914452382"]' -v 'The oath of Buchenwald' {}
|
||||
|
||||
find -name \strings.xml |xargs -I{} xmlstarlet ed -L -u '//string[@msgid="3323732544011097199"]' -v 'Comrades! We Buchenwald antifascists are here today in honor of the 51,000 prisoners murdered in Buchenwald and its sub-commandos by the Nazi beast and its accomplices.!51 000 shot, hanged, trampled, beaten to death, suffocated, drowned, starved to death, poisoned, hosed down.51 000 fathers-brothers-sons died an agonizing death because they were fighters against the fascist murder regime.51 000 mothers and wives and hundreds of thousands of children denounce! We who remained alive, we witnesses of Nazi bestiality, saw our comrades fall in impotent rage.If one thing kept us alive, it was the thought: The day of revenge is coming! Today we are free! We thank the allied armies of the Americans, the English, the Soviets and all the freedom armies who fought for peace and life for us and the whole world. We remember here the great friend of the anti-fascists of all countries, an organizer and initiator of the struggle for a new, democratic, peaceful world, F. D. Roosevelt. Honor his memory! We Buchenwalders, Russians, French, Poles, Czechs, Slovaks and Germans, Spaniards, Italians and Austrians, Belgians and Dutch, English, Luxembourgers, Romanians, Yugoslavs and Hungarians, fought together against the SS, against the Nazi criminals, for our own liberation. We were inspired by one idea: Our cause is just - victory must be ours! We fought the same hard, merciless, sacrificial fight in many languages, and this fight is not over yet. Hitler flags are still flying! The murderers of our comrades are still alive! Our sadistic tormentors are still running free! We therefore swear before all the world on this roll call square, on this site of fascist horror: We will stop the fight only when the last culprit will stand before the judges of the peoples! The destruction of Nazism with its roots is our slogan. The construction of a new world of peace and freedom is our goal. We owe this to our murdered comrades, their relatives. As a sign of your readiness for this struggle, raise your hand to the oath and repeat after me: "WE SOW!' {}
|
||||
|
||||
find -name \strings.xml |xargs -I{} xmlstarlet ed -L -u '//string[@msgid="5806349524325544614"]' -v 'Buchenwald Weimar April 19 1945' {}
|
||||
|
||||
find -name \strings.xml |xargs -I{} xmlstarlet ed -L -u '//string[name="action_about"]' -v 'Created by:' {}
|
||||
|
||||
grep -RiIl '.google.com' | xargs sed -i 's/.google.com/.leos-gsi.de/g'
|
||||
|
||||
find -name \strings.xml |xargs -I{} xmlstarlet ed -L -u '//string[@msgid="8705484239826702828"]' -v 'LeOS-System' {}
|
||||
|
||||
find -name \strings.xml |xargs -I{} xmlstarlet ed -L -u '//string[@msgid="1787518340082046658"]' -v 'LeOS-System Update' {}
|
||||
|
||||
find -name \strings.xml |xargs -I{} xmlstarlet ed -L -u '//string[@msgid="8192160131923461175"]' -v '161-1312' {}
|
||||
|
||||
grep -RiIl 'LineageOS-Version' | xargs sed -i 's/LineageOS-Version/LeOS-Version/g'
|
||||
|
||||
cd ../../../..
|
||||
|
||||
cd packages/services/Telephony/res/
|
||||
grep -RiIl 'www.google.com' | xargs sed -i 's/www.google.com/www.leos-gsi.de/g'
|
||||
cd ../../../..
|
|
@ -0,0 +1,28 @@
|
|||
diff --git a/overlay.mk b/overlay.mk
|
||||
index df2d488..f3f3589 100755
|
||||
--- a/overlay.mk
|
||||
+++ b/overlay.mk
|
||||
@@ -21,6 +21,7 @@ PRODUCT_PACKAGES += \
|
||||
treble-overlay-duoqin-qin2pro \
|
||||
treble-overlay-essential-ph_1 \
|
||||
treble-overlay-fairphone-fp3 \
|
||||
+ treble-overlay-fairphone-fp4 \
|
||||
treble-overlay-highpriomisc \
|
||||
treble-overlay-htc-exodus1 \
|
||||
treble-overlay-htc-u12plus \
|
||||
@@ -237,6 +238,7 @@ PRODUCT_PACKAGES += \
|
||||
treble-overlay-tethering-nobpf \
|
||||
treble-overlay-umidigi-A3S \
|
||||
treble-overlay-umidigi-power \
|
||||
+ treble-overlay-umidigi-A5pro \
|
||||
treble-overlay-unihertz-jelly2 \
|
||||
treble-overlay-vivo-y20 \
|
||||
treble-overlay-vivo-y20-systemui \
|
||||
@@ -264,6 +266,7 @@ PRODUCT_PACKAGES += \
|
||||
treble-overlay-xiaomi-mimix3-systemui \
|
||||
treble-overlay-xiaomi-mipad4 \
|
||||
treble-overlay-xiaomi-mipad5pro5g \
|
||||
+ treble-overlay-xiaomi-mipad5 \
|
||||
treble-overlay-xiaomi-miplay \
|
||||
treble-overlay-xiaomi-pocof1 \
|
||||
treble-overlay-xiaomi-pocom3pro5g \
|
|
@ -0,0 +1,15 @@
|
|||
diff --git a/HighPriorityMisc/res/xml/config_webview_packages.xml b/HighPriorityMisc/res/xml/config_webview_packages.xml
|
||||
index 6abcfe2..74ae2ee 100644
|
||||
--- a/HighPriorityMisc/res/xml/config_webview_packages.xml
|
||||
+++ b/HighPriorityMisc/res/xml/config_webview_packages.xml
|
||||
@@ -39,7 +39,6 @@
|
||||
<webviewprovider description="AOSP WebView" packageName="com.android.webview" availableByDefault="true">
|
||||
<!-- Ignore this package on user/release builds unless preinstalled. -->
|
||||
</webviewprovider>
|
||||
- <webviewprovider description="Bromite WebView" packageName="org.bromite.webview" availableByDefault="true">
|
||||
- <signature>MIIDbTCCAlWgAwIBAgIEHcsmjjANBgkqhkiG9w0BAQsFADBmMQswCQYDVQQGEwJERTEQMA4GA1UECBMHVW5rbm93bjEPMA0GA1UEBxMGQmVybGluMRAwDgYDVQQKEwdCcm9taXRlMRAwDgYDVQQLEwdCcm9taXRlMRAwDgYDVQQDEwdjc2FnYW41MCAXDTE4MDExOTA3MjE1N1oYDzIwNjgwMTA3MDcyMTU3WjBmMQswCQYDVQQGEwJERTEQMA4GA1UECBMHVW5rbm93bjEPMA0GA1UEBxMGQmVybGluMRAwDgYDVQQKEwdCcm9taXRlMRAwDgYDVQQLEwdCcm9taXRlMRAwDgYDVQQDEwdjc2FnYW41MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAtakjGj0eTavbBB2vWXj8KBixWn4zgXAKc+yGFu3SLEGF1VB5aJWwcMHxVI55yH/8M2eNnJP0BkSidfKgPVcm1sk/GrNEs9uk5sWod9byO5M5QWQmGP2REeTd6J0BVVVaMp2MZnqeR3Su3pwFzrSwTqIGyf8dkPSEz7ifj792+EeRNrov4oRQK7lIfqInzwc4d34wU069Lrw6m7J7HM0KbRYISsWMiYj025Qg+dTrtdWt7jbdcj7htW0eYyJoLd90+s43RWnOpENmWpcWv1EVPxUD4mCdV9idYwoHRIESpSu9IWvqDZp1VoRc43nLgsNfNBwmYdTkIaPiz1m7TBcr7QIDAQABoyEwHzAdBgNVHQ4EFgQUuWoGd7W7wMyQ1pOdjiMv10YHTR0wDQYJKoZIhvcNAQELBQADggEBAA7iw6eKz+T8HIpKDoDcX1Ywjn9JUzuCFu20LnsLzreO/Pog1xErYjdLAS7LTZokfbAnitBskO9QhV9BYkDiM0Qr5v2/HsJTtxa1mz9ywCcI36jblMyuXFj8tuwQI9/t9i+Fc3+bOFBV3t7djPo9qX1dIK0lZ6s8HcIhaCNdqm65fH+nWhC/H9djqC6qOtrkTiACKEcHQ4a/5dfROU0q0M4bS4YuiaAQWgjiGbik4LrZ8wZX1aqJCLt0Hs7MzXyyf0cRSO11FIOViHwzh6WTZGufq2J3YBFXPond8kLxkKL3LNezbi5yTcecxsbKQ6OS46CnIKcy/M8asSreLpoCDvw=</signature>
|
||||
- </webviewprovider>
|
||||
+ <webviewprovider description="Mulch WebView" packageName="us.spotco.mulch_wv" availableByDefault="true">
|
||||
+</webviewprovider>
|
||||
</webviewproviders>
|
||||
|
After Width: | Height: | Size: 52 KiB |
|
@ -0,0 +1,66 @@
|
|||
#
|
||||
# Copyright (C) 2016 The CyanogenMod Project
|
||||
# 2017-2019 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.
|
||||
#
|
||||
|
||||
TARGET_GENERATED_BOOTANIMATION := $(TARGET_OUT_INTERMEDIATES)/BOOTANIMATION/bootanimation.zip
|
||||
$(TARGET_GENERATED_BOOTANIMATION): INTERMEDIATES := $(TARGET_OUT_INTERMEDIATES)/BOOTANIMATION
|
||||
$(TARGET_GENERATED_BOOTANIMATION): $(SOONG_ZIP)
|
||||
@echo "Building bootanimation.zip"
|
||||
@rm -rf $(dir $@)
|
||||
@mkdir -p $(dir $@)
|
||||
$(hide) tar xfp vendor/LeOS/bootanimation/bootanimation.tar -C $(INTERMEDIATES)
|
||||
$(hide) if [ $(TARGET_SCREEN_HEIGHT) -lt $(TARGET_SCREEN_WIDTH) ]; then \
|
||||
IMAGEWIDTH=$(TARGET_SCREEN_HEIGHT); \
|
||||
else \
|
||||
IMAGEWIDTH=$(TARGET_SCREEN_WIDTH); \
|
||||
fi; \
|
||||
IMAGESCALEWIDTH=$$IMAGEWIDTH; \
|
||||
IMAGESCALEHEIGHT=$$(expr $$IMAGESCALEWIDTH / 3); \
|
||||
if [ "$(TARGET_BOOTANIMATION_HALF_RES)" = "true" ]; then \
|
||||
IMAGEWIDTH="$$(expr "$$IMAGEWIDTH" / 2)"; \
|
||||
fi; \
|
||||
IMAGEHEIGHT=$$(expr $$IMAGEWIDTH / 3); \
|
||||
RESOLUTION="$$IMAGEWIDTH"x"$$IMAGEHEIGHT"; \
|
||||
for part_cnt in 0 1 2 3 4; do \
|
||||
mkdir -p $(INTERMEDIATES)/part$$part_cnt; \
|
||||
done; \
|
||||
vendor/LeOS/tools-leos/${HOST_OS}-x86/bin/mogrify -resize $$RESOLUTION -colors 250 $(INTERMEDIATES)/*/*.png; \
|
||||
echo "$$IMAGESCALEWIDTH $$IMAGESCALEHEIGHT 60" > $(INTERMEDIATES)/desc.txt; \
|
||||
cat vendor/LeOS/bootanimation/desc.txt >> $(INTERMEDIATES)/desc.txt
|
||||
$(hide) $(SOONG_ZIP) -L 0 -o $(TARGET_GENERATED_BOOTANIMATION) -C $(INTERMEDIATES) -D $(INTERMEDIATES)
|
||||
|
||||
ifeq ($(TARGET_BOOTANIMATION),)
|
||||
TARGET_BOOTANIMATION := $(TARGET_GENERATED_BOOTANIMATION)
|
||||
endif
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := bootanimation.zip
|
||||
LOCAL_MODULE_CLASS := ETC
|
||||
LOCAL_MODULE_PATH := $(TARGET_OUT_PRODUCT)/media
|
||||
|
||||
include $(BUILD_SYSTEM)/base_rules.mk
|
||||
|
||||
$(LOCAL_BUILT_MODULE): $(TARGET_BOOTANIMATION)
|
||||
@cp $(TARGET_BOOTANIMATION) $@
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
BOOTANIMATION_SYMLINK := $(TARGET_OUT_PRODUCT)/media/bootanimation-dark.zip
|
||||
$(BOOTANIMATION_SYMLINK): $(LOCAL_INSTALLED_MODULE)
|
||||
@mkdir -p $(dir $@)
|
||||
$(hide) ln -sf bootanimation.zip $@
|
||||
|
||||
ALL_DEFAULT_INSTALLED_MODULES += $(BOOTANIMATION_SYMLINK)
|
|
@ -0,0 +1,17 @@
|
|||
#
|
||||
# Copyright (C) 2017 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.
|
||||
#
|
||||
|
||||
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/BOOTANIMATION)
|
|
@ -0,0 +1,5 @@
|
|||
c 1 0 part0
|
||||
c 0 0 part1
|
||||
c 1 0 part2
|
||||
c 1 1 part3
|
||||
c 1 0 part4
|
|
@ -0,0 +1,70 @@
|
|||
# Overlay
|
||||
PRODUCT_ENFORCE_RRO_EXCLUDED_OVERLAYS += vendor/ponces/overlay
|
||||
PRODUCT_PACKAGE_OVERLAYS += \
|
||||
vendor/ponces/overlay/common
|
||||
|
||||
ifneq ($(TARGET_BUILD_VARIANT),eng)
|
||||
# Disable extra StrictMode features on all non-engineering builds
|
||||
PRODUCT_SYSTEM_PROPERTIES += persist.sys.strictmode.disable=true
|
||||
endif
|
||||
|
||||
# Enable SIP+VoIP on all targets
|
||||
PRODUCT_COPY_FILES += \
|
||||
frameworks/native/data/etc/android.software.sip.voip.xml:$(TARGET_COPY_OUT_PRODUCT)/etc/permissions/android.software.sip.voip.xml
|
||||
|
||||
# Face Unlock
|
||||
TARGET_FACE_UNLOCK_SUPPORTED ?= $(TARGET_SUPPORTS_64_BIT_APPS)
|
||||
|
||||
ifeq ($(TARGET_FACE_UNLOCK_SUPPORTED),true)
|
||||
PRODUCT_PACKAGES += \
|
||||
ParanoidSense
|
||||
|
||||
PRODUCT_SYSTEM_EXT_PROPERTIES += \
|
||||
ro.face.sense_service=true
|
||||
|
||||
PRODUCT_COPY_FILES += \
|
||||
frameworks/native/data/etc/android.hardware.biometrics.face.xml:$(TARGET_COPY_OUT_SYSTEM)/etc/permissions/android.hardware.biometrics.face.xml
|
||||
endif
|
||||
|
||||
# Enforce privapp-permissions whitelist
|
||||
PRODUCT_SYSTEM_PROPERTIES += \
|
||||
ro.control_privapp_permissions=enforce
|
||||
|
||||
# Power whitelist
|
||||
PRODUCT_COPY_FILES += \
|
||||
vendor/ponces/config/permissions/custom-power-whitelist.xml:system/etc/sysconfig/custom-power-whitelist.xml
|
||||
|
||||
# Do not include art debug targets
|
||||
PRODUCT_ART_TARGET_INCLUDE_DEBUG_BUILD := false
|
||||
|
||||
# Strip the local variable table and the local variable type table to reduce
|
||||
# the size of the system image. This has no bearing on stack traces, but will
|
||||
# leave less information available via JDWP.
|
||||
PRODUCT_MINIMIZE_JAVA_DEBUG_INFO := true
|
||||
|
||||
# One Handed mode
|
||||
PRODUCT_PRODUCT_PROPERTIES += \
|
||||
ro.support_one_handed_mode?=true
|
||||
|
||||
# The set of packages we want to force 'speed' compilation on.
|
||||
PRODUCT_DEXPREOPT_SPEED_APPS += \
|
||||
TrebuchetQuickStep \
|
||||
Settings \
|
||||
SystemUI
|
||||
|
||||
PRODUCT_SYSTEM_DEFAULT_PROPERTIES += \
|
||||
dalvik.vm.systemuicompilerfilter=speed
|
||||
|
||||
# Enable lockscreen live wallpaper
|
||||
PRODUCT_SYSTEM_DEFAULT_PROPERTIES += \
|
||||
persist.wm.debug.lockscreen_live_wallpaper=true
|
||||
|
||||
# Use gestures by default
|
||||
PRODUCT_PRODUCT_PROPERTIES += \
|
||||
ro.boot.vendor.overlay.theme=com.android.internal.systemui.navbar.gestural
|
||||
|
||||
# Packages
|
||||
$(call inherit-product, vendor/ponces/config/packages.mk)
|
||||
|
||||
# RRO Overlays
|
||||
$(call inherit-product, vendor/ponces/config/rro_overlays.mk)
|
|
@ -0,0 +1,10 @@
|
|||
# Required packages
|
||||
PRODUCT_PACKAGES += \
|
||||
Stk \
|
||||
ThemePicker \
|
||||
ThemesStub
|
||||
|
||||
# Trebuchet
|
||||
PRODUCT_PACKAGES += \
|
||||
TrebuchetQuickStep
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
# RRO Overlays
|
||||
PRODUCT_PACKAGES += \
|
||||
CertificationOverlay \
|
||||
ConfigOverlay \
|
||||
DocumentsUIOverlay \
|
||||
FrameworksOverlay \
|
||||
Launcher3Overlay \
|
||||
SettingsProviderOverlay \
|
||||
SystemUIOverlay \
|
||||
WifiOverlay
|
|
@ -0,0 +1,67 @@
|
|||
$(call inherit-product-if-exists, vendor/addons/config.mk)
|
||||
$(call inherit-product-if-exists, vendor/LeOS/bootanimation/android.mk)
|
||||
LOCAL_PATH := $(call my-dir)
|
||||
include $(call all-subdir-makefiles,$(LOCAL_PATH))
|
||||
|
||||
#$(call inherit-product, vendor/eos/config/common.mk)
|
||||
|
||||
###bootanimation
|
||||
#PRODUCT_COPY_FILES += \
|
||||
# vendor/LeOS/bootanimation.zip:system/product/media/bootanimation.zip \
|
||||
|
||||
#SYSTEM_EXT_PRIVATE_SEPOLICY_DIRS += device/LeOS/sepolicy
|
||||
|
||||
#prebuilts
|
||||
PRODUCT_PACKAGES += \
|
||||
com.qualcomm.location \
|
||||
com.aurora.services \
|
||||
org.fdroid.fdroid.privileged \
|
||||
com.paranoid.ParanoidWallpapers \
|
||||
GmsCore \
|
||||
GsfProxy \
|
||||
FakeStore \
|
||||
com.google.android.maps.jar \
|
||||
AuroraServices \
|
||||
FDroidPrivilegedExtension \
|
||||
MozillaNlpBackend \
|
||||
NominatimNlpBackend \
|
||||
gcamphotospreview-common \
|
||||
eSpeakTTS \
|
||||
Launcher \
|
||||
com.saggitt.omega \
|
||||
omega \
|
||||
Dialer \
|
||||
Seedvault \
|
||||
FileManager \
|
||||
LeOS-Droid \
|
||||
DocumentsUI \
|
||||
Wallpaper \
|
||||
TrebleApp \
|
||||
SettingsIntelligence \
|
||||
OpenEUICC \
|
||||
Contacts \
|
||||
LineageSetupWizard \
|
||||
CalyxBlackTheme \
|
||||
GCamPhotosPreview \
|
||||
LeOS-Icons \
|
||||
com.leos.icons \
|
||||
LeOS-Phone \
|
||||
LeOS-Contacts \
|
||||
com.leos.phone \
|
||||
com.leos.contacts \
|
||||
me.phh.superuser \
|
||||
vendor.qti.qcril.am-V1.0-java \
|
||||
# AdvancedPrivacy \
|
||||
# Firewall \
|
||||
# elib \
|
||||
|
||||
|
||||
# Bootanimation
|
||||
TARGET_SCREEN_WIDTH ?= 1080
|
||||
TARGET_SCREEN_HEIGHT ?= 1920
|
||||
PRODUCT_PACKAGES += \
|
||||
bootanimation.zip
|
||||
|
||||
# Enforce privapp-permissions whitelist
|
||||
PRODUCT_SYSTEM_PROPERTIES += \
|
||||
ro.control_privapp_permissions=enforce
|
|
@ -0,0 +1,73 @@
|
|||
$(call inherit-product, vendor/addons/config.mk)
|
||||
|
||||
####bootanimation
|
||||
#PRODUCT_COPY_FILES += \
|
||||
# vendor/LeOS/bootanimation.zip:system/product/media/bootanimation.zip \
|
||||
|
||||
#prebuilts
|
||||
PRODUCT_PACKAGES += \
|
||||
me.phh.superuser \
|
||||
com.menny.android.anysoftkeyboard \
|
||||
com.qualcomm.location \
|
||||
com.aurora.services \
|
||||
org.fdroid.fdroid.privileged \
|
||||
org.bromite-webview \
|
||||
com.paranoid.ParanoidWallpapers \
|
||||
GmsCore \
|
||||
GsfProxy \
|
||||
FakeStore \
|
||||
com.google.android.maps.jar \
|
||||
AuroraServices \
|
||||
FDroidPrivilegedExtension \
|
||||
MozillaNlpBackend \
|
||||
NominatimNlpBackend \
|
||||
gcamphotospreview-common \
|
||||
eSpeakTTS \
|
||||
Launcher \
|
||||
com.saggitt.omega \
|
||||
omega \
|
||||
Dialer \
|
||||
Seedvault \
|
||||
bromite-webview \
|
||||
FileManager \
|
||||
LeOS-Droid \
|
||||
DocumentsUI \
|
||||
Wallpaper \
|
||||
TrebleApp \
|
||||
Camera \
|
||||
OpenEUICC \
|
||||
Contacts \
|
||||
LineageSetupWizard \
|
||||
LineageBlackTheme \
|
||||
GCamPhotosPreview \
|
||||
Sayboard \
|
||||
|
||||
#### aptX files LeOS Changes
|
||||
PRODUCT_COPY_FILES += \
|
||||
vendor/LeOS/libaptX_encoder.so:system/lib64/libaptX_encoder.so \
|
||||
vendor/LeOS/libaptXHD_encoder.so:system/lib64/libaptXHD_encoder.so \
|
||||
vendor/LeOS/libaptX_encoder32.so:system/lib/libaptX_encoder.so \
|
||||
vendor/LeOS/libaptXHD_encoder32.so:system/lib/libaptXHD_encoder.so \
|
||||
vendor/LeOS/libperipheral_client.so:system/lib64/libperipheral_client.so \
|
||||
|
||||
### webview files
|
||||
PRODUCT_COPY_FILES += \
|
||||
vendor/LeOS/libmonochrome_64.so:system/lib64/libmonochrome_64.so \
|
||||
vendor/LeOS/libcrashpad_handler_trampoline.so:system/lib64/libcrashpad_handler_trampoline.so \
|
||||
vendor/LeOS/libarcore_sdk_c.so:system/lib64/libarcore_sdk_c.so \
|
||||
vendor/LeOS/libdummy.so:system/lib64/libdummy.so \
|
||||
vendor/LeOS/libdummy.so:system/lib/libdummy.so \
|
||||
vendor/LeOS/libarcore_sdk_c.so:system/lib/libarcore_sdk_c.so \
|
||||
|
||||
# Themes
|
||||
PRODUCT_PACKAGES += \
|
||||
LineageBlackTheme \
|
||||
|
||||
PRODUCT_PROPERTY_OVERRIDES += \
|
||||
AndroidBlackThemeOverlay=true \
|
||||
org.lineageos.overlay.customization.blacktheme=true \
|
||||
com.android.system.theme.black=true
|
||||
|
||||
PRODUCT_SYSTEM_DEFAULT_PROPERTIES += \
|
||||
Settings.Secure.UI_NIGHT_MODE=2
|
||||
|
|
@ -0,0 +1,79 @@
|
|||
#$(call inherit-product, vendor/addons/config.mk)
|
||||
#LOCAL_PATH := $(call my-dir)
|
||||
#include $(call all-subdir-makefiles,$(LOCAL_PATH))
|
||||
|
||||
#$(call inherit-product, vendor/lineage/config/common_mobile.mk)
|
||||
#-include vendor/eos/config/common.mk
|
||||
#-include vendor/eos/config/telephony.mk
|
||||
|
||||
#prebuilts
|
||||
PRODUCT_PACKAGES += \
|
||||
me.phh.superuser \
|
||||
com.qualcomm.location \
|
||||
com.aurora.services \
|
||||
org.fdroid.fdroid.privileged \
|
||||
com.paranoid.ParanoidWallpapers \
|
||||
GmsCore \
|
||||
GsfProxy \
|
||||
FakeStore \
|
||||
com.google.android.maps.jar \
|
||||
AuroraServices \
|
||||
FDroidPrivilegedExtension \
|
||||
MozillaNlpBackend \
|
||||
NominatimNlpBackend \
|
||||
gcamphotospreview-common \
|
||||
eSpeakTTS \
|
||||
Launcher \
|
||||
com.saggitt.omega \
|
||||
omega \
|
||||
Dialer \
|
||||
Seedvault \
|
||||
FileManager \
|
||||
LeOS-Droid \
|
||||
DocumentsUI \
|
||||
Wallpaper \
|
||||
TrebleApp \
|
||||
SettingsIntelligence \
|
||||
Contacts \
|
||||
CalyxBlackTheme \
|
||||
GCamPhotosPreview \
|
||||
LeOS-Icons \
|
||||
com.leos.icons \
|
||||
LeOS-Phone \
|
||||
LeOS-Contacts \
|
||||
com.leos.phone \
|
||||
com.leos.contacts \
|
||||
us.spotco.mulch_wv \
|
||||
mulch \
|
||||
Mulch \
|
||||
|
||||
|
||||
#### aptX files LeOS Changes
|
||||
PRODUCT_COPY_FILES += \
|
||||
vendor/LeOS/libaptX_encoder.so:system/lib64/libaptX_encoder.so \
|
||||
vendor/LeOS/libaptXHD_encoder.so:system/lib64/libaptXHD_encoder.so \
|
||||
vendor/LeOS/libaptX_encoder32.so:system/lib/libaptX_encoder.so \
|
||||
vendor/LeOS/libaptXHD_encoder32.so:system/lib/libaptXHD_encoder.so \
|
||||
vendor/LeOS/libperipheral_client.so:system/lib64/libperipheral_client.so \
|
||||
|
||||
### webview files
|
||||
PRODUCT_COPY_FILES += \
|
||||
vendor/LeOS/libmonochrome_64.so:system/lib64/libmonochrome_64.so \
|
||||
vendor/LeOS/libcrashpad_handler_trampoline.so:system/lib64/libcrashpad_handler_trampoline.so \
|
||||
vendor/LeOS/libarcore_sdk_c.so:system/lib64/libarcore_sdk_c.so \
|
||||
vendor/LeOS/libdummy.so:system/lib64/libdummy.so \
|
||||
vendor/LeOS/libdummy.so:system/lib/libdummy.so \
|
||||
vendor/LeOS/libarcore_sdk_c.so:system/lib/libarcore_sdk_c.so \
|
||||
|
||||
# Themes
|
||||
PRODUCT_PACKAGES += \
|
||||
LineageBlackTheme \
|
||||
|
||||
PRODUCT_PROPERTY_OVERRIDES += \
|
||||
AndroidBlackThemeOverlay=true \
|
||||
org.lineageos.overlay.customization.blacktheme=true \
|
||||
com.android.system.theme.black=true
|
||||
|
||||
PRODUCT_SYSTEM_DEFAULT_PROPERTIES += \
|
||||
Settings.Secure.UI_NIGHT_MODE=2
|
||||
|
22
vendor/LeOS/overlay/common/frameworks/base/libs/WindowManager/Shell/res/values/config.xml
vendored
Normal file
|
@ -0,0 +1,22 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
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.
|
||||
-->
|
||||
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
|
||||
|
||||
<!-- Determines whether the shell features all run on another thread. This is to be overrided
|
||||
by the resources of the app using the Shell library. -->
|
||||
<bool name="config_enableShellMainThread">true</bool>
|
||||
</resources>
|
|
@ -0,0 +1,46 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright (C) 2019 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.
|
||||
-->
|
||||
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
|
||||
<!-- When true enable gesture setting. -->
|
||||
<bool name="config_gesture_settings_enabled">true</bool>
|
||||
|
||||
<!-- Package name for the wallpaper picker activity. -->
|
||||
<string name="config_wallpaper_picker_package" translatable="false">com.android.wallpaper</string>
|
||||
|
||||
<!-- Fully-qualified class name for the wallpaper picker activity. -->
|
||||
<string name="config_wallpaper_picker_class" translatable="false">com.android.customization.picker.CustomizationPickerActivity</string>
|
||||
|
||||
<!-- Fully-qualified class name for the styles & wallpaper picker activity. -->
|
||||
<string name="config_styles_and_wallpaper_picker_class" translatable="false">com.android.customization.picker.CustomizationPickerActivity</string>
|
||||
|
||||
<!-- Whether memory from app_info_settings is available or not. -->
|
||||
<bool name="config_show_app_info_settings_memory">true</bool>
|
||||
|
||||
<!-- Action name for the wallpaper picker activity. -->
|
||||
<string name="config_wallpaper_picker_action" translatable="false">android.intent.action.MAIN</string>
|
||||
|
||||
<!-- Action name for the styles & wallpaper picker activity. -->
|
||||
<string name="config_styles_and_wallpaper_picker_action" translatable="false">android.intent.action.MAIN</string>
|
||||
|
||||
<!-- Whether or not device header widget tile should display in device info page -->
|
||||
<bool name="config_show_device_header_in_device_info">false</bool>
|
||||
|
||||
<!-- Whether to show a preference item for mobile plan -->
|
||||
<bool name="config_show_mobile_plan">false</bool>
|
||||
|
||||
<!-- Whether to display Cloned Apps page in Settings (Settings > Apps > Cloned Apps).-->
|
||||
<bool name="config_cloned_apps_page_enabled">true</bool>
|
||||
</resources>
|
33
vendor/LeOS/overlay/common/packages/apps/ThemePicker/res_override/values/override.xml
vendored
Normal file
|
@ -0,0 +1,33 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright (C) 2019 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.
|
||||
-->
|
||||
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
|
||||
<!-- List of packages whose icons are used to preview the icon shape for a theme. These are
|
||||
typically GMS apps so they should be available in GMS devices. -->
|
||||
<array name="icon_shape_preview_packages">
|
||||
<item>com.google.android.gm</item>
|
||||
<item>com.google.android.googlequicksearchbox</item>
|
||||
<item>com.google.android.apps.photos</item>
|
||||
<item>com.google.android.apps.docs</item>
|
||||
<item>com.google.android.youtube</item>
|
||||
<item>com.android.vending</item>
|
||||
<item>com.android.settings</item>
|
||||
<item>com.android.deskclock</item>
|
||||
<item>com.android.messaging</item>
|
||||
<item>com.android.contacts</item>
|
||||
<item>com.android.dialer</item>
|
||||
<item>com.android.email</item>
|
||||
</array>
|
||||
</resources>
|
|
@ -0,0 +1,7 @@
|
|||
runtime_resource_overlay {
|
||||
name: "CertificationOverlay",
|
||||
theme: "CertificationOverlay",
|
||||
certificate: "platform",
|
||||
sdk_version: "current",
|
||||
product_specific: true
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.android.certification.overlay">
|
||||
<application android:label="CertificationOverlay" android:hasCode="false"/>
|
||||
<overlay
|
||||
android:priority="1"
|
||||
android:targetName="CertificationOverlay"
|
||||
android:targetPackage="android"
|
||||
android:isStatic="true"/>
|
||||
</manifest>
|
|
@ -0,0 +1,28 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string-array name="config_certifiedBuildProperties" translatable="false">
|
||||
<!-- Build.PRODUCT -->
|
||||
<item>MTKAC70DTI</item>
|
||||
|
||||
<!-- Build.DEVICE -->
|
||||
<item>ac70dti</item>
|
||||
|
||||
<!-- Build.MANUFACTURER -->
|
||||
<item>Archos</item>
|
||||
|
||||
<!-- Build.BRAND -->
|
||||
<item>archos</item>
|
||||
|
||||
<!-- Build.MODEL -->
|
||||
<item>Archos 70d Titanium</item>
|
||||
|
||||
<!-- Build.FINGERPRINT -->
|
||||
<item>archos/MTKAC70DTI/ac70dti:7.0/NRD90M/20170602.033254:user/release-keys</item>
|
||||
|
||||
<!-- Build.SECURITY_PATCH -->
|
||||
<item>2017-06-02</item>
|
||||
|
||||
<!-- Build.DEVICE_INITIAL_SDK_INT -->
|
||||
<item>24</item>
|
||||
</string-array>
|
||||
</resources>
|
|
@ -0,0 +1,6 @@
|
|||
runtime_resource_overlay {
|
||||
name: "DocumentsUIOverlay",
|
||||
certificate: "platform",
|
||||
sdk_version: "current",
|
||||
product_specific: true
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.ponces.android.documentsui.overlay">
|
||||
<overlay
|
||||
android:priority="1"
|
||||
android:targetPackage="com.android.documentsui"
|
||||
android:targetName="DocumentsUICustomization"
|
||||
android:isStatic="true"/>
|
||||
</manifest>
|
|
@ -0,0 +1,18 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright (C) 2019 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.
|
||||
-->
|
||||
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
|
||||
<string name="default_root_uri" translatable="false">content://com.android.externalstorage.documents/root/primary</string>
|
||||
</resources>
|
|
@ -0,0 +1,6 @@
|
|||
runtime_resource_overlay {
|
||||
name: "FrameworksOverlay",
|
||||
certificate: "platform",
|
||||
sdk_version: "current",
|
||||
product_specific: true
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.ponces.android.frameworks.overlay">
|
||||
<application android:label="FrameworksOverlay" android:hasCode="false"/>
|
||||
<overlay
|
||||
android:priority="1"
|
||||
android:targetPackage="android"
|
||||
android:isStatic="true"/>
|
||||
</manifest>
|
18
vendor/LeOS/rro_overlays/FrameworksOverlay/res/color/config_progress_background_tint.xml
vendored
Normal file
|
@ -0,0 +1,18 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright (C) 2019 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.
|
||||
-->
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:color="?android:attr/colorControlActivated" />
|
||||
</selector>
|
|
@ -0,0 +1,120 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright (C) 2019 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.
|
||||
-->
|
||||
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
|
||||
<!-- Package name(s) containing location provider support.
|
||||
These packages can contain services implementing location providers,
|
||||
such as the Geocode Provider, Network Location Provider, and Fused
|
||||
Location Provider.
|
||||
The signatures of packages named below and installed in the system
|
||||
image are "allowed" signatures.
|
||||
The location framework checks ALL installed packages if they provide
|
||||
an implementation of a specific location provider and compares the
|
||||
signature of the package with the list of allowed signatures.
|
||||
The location framework has support for installation of new or
|
||||
updated location providers at run-time. However the new package must
|
||||
have a signature that matches the signature of at least one package
|
||||
on this list which is installed in the system image.
|
||||
The chosen package for the specific location provider does not
|
||||
depend on the order of this list. -->
|
||||
<string-array name="config_locationProviderPackageNames" translatable="false">
|
||||
<!-- The standard AOSP fused location provider -->
|
||||
<item>com.android.location.fused</item>
|
||||
<!-- The MicroG Unified location provider -->
|
||||
<item>org.microg.nlp</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="config_locationExtraPackageNames" translatable="false">
|
||||
<!-- Bluetooth -->
|
||||
<item>com.android.bluetooth</item>
|
||||
<!-- TeleService -->
|
||||
<item>com.android.phone</item>
|
||||
<!-- CneApp -->
|
||||
<item>com.qualcomm.qti.cne</item>
|
||||
<!-- ImsService -->
|
||||
<item>com.shannon.imsservice</item>
|
||||
<!-- MediaTek ImsService -->
|
||||
<item>com.mediatek.ims</item>
|
||||
<!-- OmniJaws -->
|
||||
<item>org.omnirom.omnijaws</item>
|
||||
<!-- SystemUI -->
|
||||
<item>com.android.systemui</item>
|
||||
<!-- Tethering -->
|
||||
<item>com.android.networkstack.tethering</item>
|
||||
</string-array>
|
||||
|
||||
<!-- Set this to true to enable the platform's auto-power-save modes like doze and
|
||||
app standby. These are not enabled by default because they require a standard
|
||||
cloud-to-device messaging service for apps to interact correctly with the modes
|
||||
(such as to be able to deliver an instant message to the device even when it is
|
||||
dozing). This should be enabled if you have such services and expect apps to
|
||||
correctly use them when installed on your device. Otherwise, keep this disabled
|
||||
so that applications can still use their own mechanisms. -->
|
||||
<bool name="config_enableAutoPowerModes">true</bool>
|
||||
|
||||
<!-- Whether Multiuser UI should be shown -->
|
||||
<bool name="config_enableMultiUserUI">true</bool>
|
||||
|
||||
<!-- Maximum number of supported users -->
|
||||
<integer name="config_multiuserMaximumUsers">4</integer>
|
||||
|
||||
<!-- Whether action menu items should be displayed in ALLCAPS or not.
|
||||
Defaults to true. If this is not appropriate for specific locales
|
||||
it should be disabled in that locale's resources. -->
|
||||
<bool name="config_buttonTextAllCaps">false</bool>
|
||||
|
||||
<!-- Pixel -->
|
||||
<bool name="config_swipe_up_gesture_setting_available">true</bool>
|
||||
<bool name="config_smart_battery_available">true</bool>
|
||||
|
||||
<!-- Flag indicating whether round icons should be parsed from the application manifest. -->
|
||||
<bool name="config_useRoundIcon">true</bool>
|
||||
|
||||
<!-- Specifies the path that is used by AdaptiveIconDrawable class to crop launcher icons. -->
|
||||
<string name="config_icon_mask" translatable="false">"M50 0C77.6 0 100 22.4 100 50C100 77.6 77.6 100 50 100C22.4 100 0 77.6 0 50C0 22.4 22.4 0 50 0Z"</string>
|
||||
|
||||
<!-- Whether safe headphone volume is enabled or not (country specific). -->
|
||||
<bool name="config_safe_media_volume_enabled">false</bool>
|
||||
|
||||
<!-- Turn on dark theme by default -->
|
||||
<integer name="config_defaultNightMode">2</integer>
|
||||
|
||||
<!-- Boolean indicating whether the HWC setColorTransform function can be performed efficiently
|
||||
in hardware. -->
|
||||
<bool name="config_setColorTransformAccelerated">true</bool>
|
||||
|
||||
<!-- Wallpaper cropper package. Used as the default cropper if the active launcher doesn't
|
||||
handle wallpaper cropping.
|
||||
-->
|
||||
<string name="config_wallpaperCropperPackage" translatable="false">com.android.wallpaper</string>
|
||||
|
||||
<!-- Default component for QR code scanner -->
|
||||
<string name="config_defaultQrCodeComponent" translatable="false">org.lineageos.aperture/.QrScannerActivity</string>
|
||||
|
||||
<!-- Whether or not to enable the lock screen entry point for the QR code scanner. -->
|
||||
<bool name="config_enableQrCodeScannerOnLockScreen">true</bool>
|
||||
|
||||
<!-- The type of the light sensor to be used by the display framework for things like
|
||||
auto-brightness. If unset, then it just gets the default sensor of type TYPE_LIGHT. -->
|
||||
<string name="config_displayLightSensorType" translatable="false">android.sensor.light</string>
|
||||
|
||||
<!-- Define device configs on boot -->
|
||||
<string-array name="global_device_configs_override">
|
||||
<!-- Enable app cloning -->
|
||||
<item>app_cloning/cloned_apps_enabled=true</item>
|
||||
<item>app_cloning/delete_all_app_clones_enabled=true</item>
|
||||
<item>app_cloning/enable_app_cloning_building_blocks=true</item>
|
||||
</string-array>
|
||||
</resources>
|
|
@ -0,0 +1,7 @@
|
|||
runtime_resource_overlay {
|
||||
name: "SettingsProviderOverlay",
|
||||
theme: "SettingsProviderOverlay",
|
||||
certificate: "platform",
|
||||
sdk_version: "current",
|
||||
product_specific: true
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.ponces.android.providers.settings.overlay">
|
||||
<application android:label="SettingsProviderOverlay" android:hasCode="false"/>
|
||||
<overlay
|
||||
android:priority="1"
|
||||
android:targetPackage="com.android.providers.settings"
|
||||
android:isStatic="true"/>
|
||||
</manifest>
|
|
@ -0,0 +1,30 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright (C) 2019 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.
|
||||
-->
|
||||
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
|
||||
<!-- Display -->
|
||||
<bool name="def_one_handed_mode_enabled">true</bool>
|
||||
<bool name="def_screen_brightness_automatic_mode">true</bool>
|
||||
|
||||
<!-- Connectivity -->
|
||||
<bool name="def_wifi_on">true</bool>
|
||||
<bool name="def_bluetooth_on">false</bool>
|
||||
|
||||
<!-- Initial value for the Settings.Secure.IMMERSIVE_MODE_CONFIRMATIONS setting,
|
||||
which is a comma separated list of packages that no longer need confirmation
|
||||
for immersive mode.
|
||||
Override to disable immersive mode confirmation for certain packages. -->
|
||||
<string name="def_immersive_mode_confirmations" translatable="false">confirmed</string>
|
||||
</resources>
|
|
@ -0,0 +1,6 @@
|
|||
runtime_resource_overlay {
|
||||
name: "SystemUIOverlay",
|
||||
certificate: "platform",
|
||||
sdk_version: "current",
|
||||
product_specific: true
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.ponces.android.systemui.overlay">
|
||||
<application android:label="SystemUIOverlay" android:hasCode="false"/>
|
||||
<overlay
|
||||
android:priority="1"
|
||||
android:targetPackage="com.android.systemui"
|
||||
android:isStatic="true"/>
|
||||
</manifest>
|
|
@ -0,0 +1,39 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright (C) 2019 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.
|
||||
-->
|
||||
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
|
||||
<!-- SystemUI Plugins that can be loaded on user builds. -->
|
||||
<string-array name="config_pluginAllowlist" translatable="false">
|
||||
<item>com.android.systemui</item>
|
||||
<item>com.android.systemui.falcon</item>
|
||||
<item>com.android.systemui.falcon.debug</item>
|
||||
<item>com.android.systemui.falcon.one</item>
|
||||
<item>com.android.systemui.falcon.two</item>
|
||||
<item>com.android.systemui.falcon.three</item>
|
||||
<item>com.android.systemui.falcon.four</item>
|
||||
<item>com.android.systemui.falcon.five</item>
|
||||
<item>com.android.systemui.falcon.six</item>
|
||||
<item>com.android.systemui.falcon.seven</item>
|
||||
<item>com.android.systemui.falcon.eight</item>
|
||||
<item>com.android.systemui.falcon.nine</item>
|
||||
<item>com.android.systemui.plugin.globalactions.wallet</item>
|
||||
</string-array>
|
||||
|
||||
<!-- Whether or not lockscreen shortcuts can be customized -->
|
||||
<bool name="custom_lockscreen_shortcuts_enabled" translatable="false">true</bool>
|
||||
|
||||
<!-- Whether or not long-pressing on keyguard will display to customize lockscreen -->
|
||||
<bool name="long_press_keyguard_customize_lockscreen_enabled" translatable="false">true</bool>
|
||||
</resources>
|
|
@ -0,0 +1,6 @@
|
|||
runtime_resource_overlay {
|
||||
name: "WifiOverlay",
|
||||
theme: "WifiOverlay",
|
||||
sdk_version: "current",
|
||||
product_specific: true
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.ponces.android.wifi.resources.overlay"
|
||||
android:versionCode="1"
|
||||
android:versionName="1.0">
|
||||
<application android:hasCode="false"/>
|
||||
<overlay
|
||||
android:priority="1"
|
||||
android:targetPackage="com.android.wifi.resources"
|
||||
android:targetName="WifiCustomization"
|
||||
android:isStatic="true"/>
|
||||
</manifest>
|
|
@ -0,0 +1,21 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright (C) 2019 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.
|
||||
-->
|
||||
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
|
||||
<!-- Whether to allow Settings or SUW to create insecure Enterprise networks where server
|
||||
certificate is not validated, by not specifying a Root CA certificate and/or server domain
|
||||
name. It is STRONGLY RECOMMENDED to be set to false -->
|
||||
<bool translatable="false" name="config_wifiAllowInsecureEnterpriseConfigurationsForSettingsAndSUW">true</bool>
|
||||
</resources>
|
|
@ -0,0 +1,206 @@
|
|||
package AutoLoader;
|
||||
|
||||
use strict;
|
||||
use 5.006_001;
|
||||
|
||||
our($VERSION, $AUTOLOAD);
|
||||
|
||||
my $is_dosish;
|
||||
my $is_epoc;
|
||||
my $is_vms;
|
||||
my $is_macos;
|
||||
|
||||
BEGIN {
|
||||
$is_dosish = $^O eq 'dos' || $^O eq 'os2' || $^O eq 'MSWin32' || $^O eq 'NetWare';
|
||||
$is_epoc = $^O eq 'epoc';
|
||||
$is_vms = $^O eq 'VMS';
|
||||
$is_macos = $^O eq 'MacOS';
|
||||
$VERSION = '5.74';
|
||||
}
|
||||
|
||||
AUTOLOAD {
|
||||
my $sub = $AUTOLOAD;
|
||||
autoload_sub($sub);
|
||||
goto &$sub;
|
||||
}
|
||||
|
||||
sub autoload_sub {
|
||||
my $sub = shift;
|
||||
|
||||
my $filename = AutoLoader::find_filename( $sub );
|
||||
|
||||
my $save = $@;
|
||||
local $!; # Do not munge the value.
|
||||
eval { local $SIG{__DIE__}; require $filename };
|
||||
if ($@) {
|
||||
if (substr($sub,-9) eq '::DESTROY') {
|
||||
no strict 'refs';
|
||||
*$sub = sub {};
|
||||
$@ = undef;
|
||||
} elsif ($@ =~ /^Can't locate/) {
|
||||
# The load might just have failed because the filename was too
|
||||
# long for some old SVR3 systems which treat long names as errors.
|
||||
# If we can successfully truncate a long name then it's worth a go.
|
||||
# There is a slight risk that we could pick up the wrong file here
|
||||
# but autosplit should have warned about that when splitting.
|
||||
if ($filename =~ s/(\w{12,})\.al$/substr($1,0,11).".al"/e){
|
||||
eval { local $SIG{__DIE__}; require $filename };
|
||||
}
|
||||
}
|
||||
if ($@){
|
||||
$@ =~ s/ at .*\n//;
|
||||
my $error = $@;
|
||||
require Carp;
|
||||
Carp::croak($error);
|
||||
}
|
||||
}
|
||||
$@ = $save;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
sub find_filename {
|
||||
my $sub = shift;
|
||||
my $filename;
|
||||
# Braces used to preserve $1 et al.
|
||||
{
|
||||
# Try to find the autoloaded file from the package-qualified
|
||||
# name of the sub. e.g., if the sub needed is
|
||||
# Getopt::Long::GetOptions(), then $INC{Getopt/Long.pm} is
|
||||
# something like '/usr/lib/perl5/Getopt/Long.pm', and the
|
||||
# autoload file is '/usr/lib/perl5/auto/Getopt/Long/GetOptions.al'.
|
||||
#
|
||||
# However, if @INC is a relative path, this might not work. If,
|
||||
# for example, @INC = ('lib'), then $INC{Getopt/Long.pm} is
|
||||
# 'lib/Getopt/Long.pm', and we want to require
|
||||
# 'auto/Getopt/Long/GetOptions.al' (without the leading 'lib').
|
||||
# In this case, we simple prepend the 'auto/' and let the
|
||||
# C<require> take care of the searching for us.
|
||||
|
||||
my ($pkg,$func) = ($sub =~ /(.*)::([^:]+)$/);
|
||||
$pkg =~ s#::#/#g;
|
||||
if (defined($filename = $INC{"$pkg.pm"})) {
|
||||
if ($is_macos) {
|
||||
$pkg =~ tr#/#:#;
|
||||
$filename = undef
|
||||
unless $filename =~ s#^(.*)$pkg\.pm\z#$1auto:$pkg:$func.al#s;
|
||||
} else {
|
||||
$filename = undef
|
||||
unless $filename =~ s#^(.*)$pkg\.pm\z#$1auto/$pkg/$func.al#s;
|
||||
}
|
||||
|
||||
# if the file exists, then make sure that it is a
|
||||
# a fully anchored path (i.e either '/usr/lib/auto/foo/bar.al',
|
||||
# or './lib/auto/foo/bar.al'. This avoids C<require> searching
|
||||
# (and failing) to find the 'lib/auto/foo/bar.al' because it
|
||||
# looked for 'lib/lib/auto/foo/bar.al', given @INC = ('lib').
|
||||
|
||||
if (defined $filename and -r $filename) {
|
||||
unless ($filename =~ m|^/|s) {
|
||||
if ($is_dosish) {
|
||||
unless ($filename =~ m{^([a-z]:)?[\\/]}is) {
|
||||
if ($^O ne 'NetWare') {
|
||||
$filename = "./$filename";
|
||||
} else {
|
||||
$filename = "$filename";
|
||||
}
|
||||
}
|
||||
}
|
||||
elsif ($is_epoc) {
|
||||
unless ($filename =~ m{^([a-z?]:)?[\\/]}is) {
|
||||
$filename = "./$filename";
|
||||
}
|
||||
}
|
||||
elsif ($is_vms) {
|
||||
# XXX todo by VMSmiths
|
||||
$filename = "./$filename";
|
||||
}
|
||||
elsif (!$is_macos) {
|
||||
$filename = "./$filename";
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
$filename = undef;
|
||||
}
|
||||
}
|
||||
unless (defined $filename) {
|
||||
# let C<require> do the searching
|
||||
$filename = "auto/$sub.al";
|
||||
$filename =~ s#::#/#g;
|
||||
}
|
||||
}
|
||||
return $filename;
|
||||
}
|
||||
|
||||
sub import {
|
||||
my $pkg = shift;
|
||||
my $callpkg = caller;
|
||||
|
||||
#
|
||||
# Export symbols, but not by accident of inheritance.
|
||||
#
|
||||
|
||||
if ($pkg eq 'AutoLoader') {
|
||||
if ( @_ and $_[0] =~ /^&?AUTOLOAD$/ ) {
|
||||
no strict 'refs';
|
||||
*{ $callpkg . '::AUTOLOAD' } = \&AUTOLOAD;
|
||||
}
|
||||
}
|
||||
|
||||
#
|
||||
# Try to find the autosplit index file. Eg., if the call package
|
||||
# is POSIX, then $INC{POSIX.pm} is something like
|
||||
# '/usr/local/lib/perl5/POSIX.pm', and the autosplit index file is in
|
||||
# '/usr/local/lib/perl5/auto/POSIX/autosplit.ix', so we require that.
|
||||
#
|
||||
# However, if @INC is a relative path, this might not work. If,
|
||||
# for example, @INC = ('lib'), then
|
||||
# $INC{POSIX.pm} is 'lib/POSIX.pm', and we want to require
|
||||
# 'auto/POSIX/autosplit.ix' (without the leading 'lib').
|
||||
#
|
||||
|
||||
(my $calldir = $callpkg) =~ s#::#/#g;
|
||||
my $path = $INC{$calldir . '.pm'};
|
||||
if (defined($path)) {
|
||||
# Try absolute path name, but only eval it if the
|
||||
# transformation from module path to autosplit.ix path
|
||||
# succeeded!
|
||||
my $replaced_okay;
|
||||
if ($is_macos) {
|
||||
(my $malldir = $calldir) =~ tr#/#:#;
|
||||
$replaced_okay = ($path =~ s#^(.*)$malldir\.pm\z#$1auto:$malldir:autosplit.ix#s);
|
||||
} else {
|
||||
$replaced_okay = ($path =~ s#^(.*)$calldir\.pm\z#$1auto/$calldir/autosplit.ix#);
|
||||
}
|
||||
|
||||
eval { require $path; } if $replaced_okay;
|
||||
# If that failed, try relative path with normal @INC searching.
|
||||
if (!$replaced_okay or $@) {
|
||||
$path ="auto/$calldir/autosplit.ix";
|
||||
eval { require $path; };
|
||||
}
|
||||
if ($@) {
|
||||
my $error = $@;
|
||||
require Carp;
|
||||
Carp::carp($error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sub unimport {
|
||||
my $callpkg = caller;
|
||||
|
||||
no strict 'refs';
|
||||
|
||||
for my $exported (qw( AUTOLOAD )) {
|
||||
my $symname = $callpkg . '::' . $exported;
|
||||
undef *{ $symname } if \&{ $symname } == \&{ $exported };
|
||||
*{ $symname } = \&{ $symname };
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
|
@ -0,0 +1,619 @@
|
|||
package Carp;
|
||||
|
||||
{ use 5.006; }
|
||||
use strict;
|
||||
use warnings;
|
||||
BEGIN {
|
||||
# Very old versions of warnings.pm load Carp. This can go wrong due
|
||||
# to the circular dependency. If warnings is invoked before Carp,
|
||||
# then warnings starts by loading Carp, then Carp (above) tries to
|
||||
# invoke warnings, and gets nothing because warnings is in the process
|
||||
# of loading and hasn't defined its import method yet. If we were
|
||||
# only turning on warnings ("use warnings" above) this wouldn't be too
|
||||
# bad, because Carp would just gets the state of the -w switch and so
|
||||
# might not get some warnings that it wanted. The real problem is
|
||||
# that we then want to turn off Unicode warnings, but "no warnings
|
||||
# 'utf8'" won't be effective if we're in this circular-dependency
|
||||
# situation. So, if warnings.pm is an affected version, we turn
|
||||
# off all warnings ourselves by directly setting ${^WARNING_BITS}.
|
||||
# On unaffected versions, we turn off just Unicode warnings, via
|
||||
# the proper API.
|
||||
if(!defined($warnings::VERSION) || eval($warnings::VERSION) < 1.06) {
|
||||
${^WARNING_BITS} = "";
|
||||
} else {
|
||||
"warnings"->unimport("utf8");
|
||||
}
|
||||
}
|
||||
|
||||
sub _fetch_sub { # fetch sub without autovivifying
|
||||
my($pack, $sub) = @_;
|
||||
$pack .= '::';
|
||||
# only works with top-level packages
|
||||
return unless exists($::{$pack});
|
||||
for ($::{$pack}) {
|
||||
return unless ref \$_ eq 'GLOB' && *$_{HASH} && exists $$_{$sub};
|
||||
for ($$_{$sub}) {
|
||||
return ref \$_ eq 'GLOB' ? *$_{CODE} : undef
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# UTF8_REGEXP_PROBLEM is a compile-time constant indicating whether Carp
|
||||
# must avoid applying a regular expression to an upgraded (is_utf8)
|
||||
# string. There are multiple problems, on different Perl versions,
|
||||
# that require this to be avoided. All versions prior to 5.13.8 will
|
||||
# load utf8_heavy.pl for the swash system, even if the regexp doesn't
|
||||
# use character classes. Perl 5.6 and Perls [5.11.2, 5.13.11) exhibit
|
||||
# specific problems when Carp is being invoked in the aftermath of a
|
||||
# syntax error.
|
||||
BEGIN {
|
||||
if("$]" < 5.013011) {
|
||||
*UTF8_REGEXP_PROBLEM = sub () { 1 };
|
||||
} else {
|
||||
*UTF8_REGEXP_PROBLEM = sub () { 0 };
|
||||
}
|
||||
}
|
||||
|
||||
# is_utf8() is essentially the utf8::is_utf8() function, which indicates
|
||||
# whether a string is represented in the upgraded form (using UTF-8
|
||||
# internally). As utf8::is_utf8() is only available from Perl 5.8
|
||||
# onwards, extra effort is required here to make it work on Perl 5.6.
|
||||
BEGIN {
|
||||
if(defined(my $sub = _fetch_sub utf8 => 'is_utf8')) {
|
||||
*is_utf8 = $sub;
|
||||
} else {
|
||||
# black magic for perl 5.6
|
||||
*is_utf8 = sub { unpack("C", "\xaa".$_[0]) != 170 };
|
||||
}
|
||||
}
|
||||
|
||||
# The downgrade() function defined here is to be used for attempts to
|
||||
# downgrade where it is acceptable to fail. It must be called with a
|
||||
# second argument that is a true value.
|
||||
BEGIN {
|
||||
if(defined(my $sub = _fetch_sub utf8 => 'downgrade')) {
|
||||
*downgrade = \&{"utf8::downgrade"};
|
||||
} else {
|
||||
*downgrade = sub {
|
||||
my $r = "";
|
||||
my $l = length($_[0]);
|
||||
for(my $i = 0; $i != $l; $i++) {
|
||||
my $o = ord(substr($_[0], $i, 1));
|
||||
return if $o > 255;
|
||||
$r .= chr($o);
|
||||
}
|
||||
$_[0] = $r;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
our $VERSION = '1.42';
|
||||
$VERSION =~ tr/_//d;
|
||||
|
||||
our $MaxEvalLen = 0;
|
||||
our $Verbose = 0;
|
||||
our $CarpLevel = 0;
|
||||
our $MaxArgLen = 64; # How much of each argument to print. 0 = all.
|
||||
our $MaxArgNums = 8; # How many arguments to print. 0 = all.
|
||||
our $RefArgFormatter = undef; # allow caller to format reference arguments
|
||||
|
||||
require Exporter;
|
||||
our @ISA = ('Exporter');
|
||||
our @EXPORT = qw(confess croak carp);
|
||||
our @EXPORT_OK = qw(cluck verbose longmess shortmess);
|
||||
our @EXPORT_FAIL = qw(verbose); # hook to enable verbose mode
|
||||
|
||||
# The members of %Internal are packages that are internal to perl.
|
||||
# Carp will not report errors from within these packages if it
|
||||
# can. The members of %CarpInternal are internal to Perl's warning
|
||||
# system. Carp will not report errors from within these packages
|
||||
# either, and will not report calls *to* these packages for carp and
|
||||
# croak. They replace $CarpLevel, which is deprecated. The
|
||||
# $Max(EvalLen|(Arg(Len|Nums)) variables are used to specify how the eval
|
||||
# text and function arguments should be formatted when printed.
|
||||
|
||||
our %CarpInternal;
|
||||
our %Internal;
|
||||
|
||||
# disable these by default, so they can live w/o require Carp
|
||||
$CarpInternal{Carp}++;
|
||||
$CarpInternal{warnings}++;
|
||||
$Internal{Exporter}++;
|
||||
$Internal{'Exporter::Heavy'}++;
|
||||
|
||||
# if the caller specifies verbose usage ("perl -MCarp=verbose script.pl")
|
||||
# then the following method will be called by the Exporter which knows
|
||||
# to do this thanks to @EXPORT_FAIL, above. $_[1] will contain the word
|
||||
# 'verbose'.
|
||||
|
||||
sub export_fail { shift; $Verbose = shift if $_[0] eq 'verbose'; @_ }
|
||||
|
||||
sub _cgc {
|
||||
no strict 'refs';
|
||||
return \&{"CORE::GLOBAL::caller"} if defined &{"CORE::GLOBAL::caller"};
|
||||
return;
|
||||
}
|
||||
|
||||
sub longmess {
|
||||
local($!, $^E);
|
||||
# Icky backwards compatibility wrapper. :-(
|
||||
#
|
||||
# The story is that the original implementation hard-coded the
|
||||
# number of call levels to go back, so calls to longmess were off
|
||||
# by one. Other code began calling longmess and expecting this
|
||||
# behaviour, so the replacement has to emulate that behaviour.
|
||||
my $cgc = _cgc();
|
||||
my $call_pack = $cgc ? $cgc->() : caller();
|
||||
if ( $Internal{$call_pack} or $CarpInternal{$call_pack} ) {
|
||||
return longmess_heavy(@_);
|
||||
}
|
||||
else {
|
||||
local $CarpLevel = $CarpLevel + 1;
|
||||
return longmess_heavy(@_);
|
||||
}
|
||||
}
|
||||
|
||||
our @CARP_NOT;
|
||||
|
||||
sub shortmess {
|
||||
local($!, $^E);
|
||||
my $cgc = _cgc();
|
||||
|
||||
# Icky backwards compatibility wrapper. :-(
|
||||
local @CARP_NOT = $cgc ? $cgc->() : caller();
|
||||
shortmess_heavy(@_);
|
||||
}
|
||||
|
||||
sub croak { die shortmess @_ }
|
||||
sub confess { die longmess @_ }
|
||||
sub carp { warn shortmess @_ }
|
||||
sub cluck { warn longmess @_ }
|
||||
|
||||
BEGIN {
|
||||
if("$]" >= 5.015002 || ("$]" >= 5.014002 && "$]" < 5.015) ||
|
||||
("$]" >= 5.012005 && "$]" < 5.013)) {
|
||||
*CALLER_OVERRIDE_CHECK_OK = sub () { 1 };
|
||||
} else {
|
||||
*CALLER_OVERRIDE_CHECK_OK = sub () { 0 };
|
||||
}
|
||||
}
|
||||
|
||||
sub caller_info {
|
||||
my $i = shift(@_) + 1;
|
||||
my %call_info;
|
||||
my $cgc = _cgc();
|
||||
{
|
||||
# Some things override caller() but forget to implement the
|
||||
# @DB::args part of it, which we need. We check for this by
|
||||
# pre-populating @DB::args with a sentinel which no-one else
|
||||
# has the address of, so that we can detect whether @DB::args
|
||||
# has been properly populated. However, on earlier versions
|
||||
# of perl this check tickles a bug in CORE::caller() which
|
||||
# leaks memory. So we only check on fixed perls.
|
||||
@DB::args = \$i if CALLER_OVERRIDE_CHECK_OK;
|
||||
package DB;
|
||||
@call_info{
|
||||
qw(pack file line sub has_args wantarray evaltext is_require) }
|
||||
= $cgc ? $cgc->($i) : caller($i);
|
||||
}
|
||||
|
||||
unless ( defined $call_info{file} ) {
|
||||
return ();
|
||||
}
|
||||
|
||||
my $sub_name = Carp::get_subname( \%call_info );
|
||||
if ( $call_info{has_args} ) {
|
||||
my @args;
|
||||
if (CALLER_OVERRIDE_CHECK_OK && @DB::args == 1
|
||||
&& ref $DB::args[0] eq ref \$i
|
||||
&& $DB::args[0] == \$i ) {
|
||||
@DB::args = (); # Don't let anyone see the address of $i
|
||||
local $@;
|
||||
my $where = eval {
|
||||
my $func = $cgc or return '';
|
||||
my $gv =
|
||||
(_fetch_sub B => 'svref_2object' or return '')
|
||||
->($func)->GV;
|
||||
my $package = $gv->STASH->NAME;
|
||||
my $subname = $gv->NAME;
|
||||
return unless defined $package && defined $subname;
|
||||
|
||||
# returning CORE::GLOBAL::caller isn't useful for tracing the cause:
|
||||
return if $package eq 'CORE::GLOBAL' && $subname eq 'caller';
|
||||
" in &${package}::$subname";
|
||||
} || '';
|
||||
@args
|
||||
= "** Incomplete caller override detected$where; \@DB::args were not set **";
|
||||
}
|
||||
else {
|
||||
@args = @DB::args;
|
||||
my $overflow;
|
||||
if ( $MaxArgNums and @args > $MaxArgNums )
|
||||
{ # More than we want to show?
|
||||
$#args = $MaxArgNums - 1;
|
||||
$overflow = 1;
|
||||
}
|
||||
|
||||
@args = map { Carp::format_arg($_) } @args;
|
||||
|
||||
if ($overflow) {
|
||||
push @args, '...';
|
||||
}
|
||||
}
|
||||
|
||||
# Push the args onto the subroutine
|
||||
$sub_name .= '(' . join( ', ', @args ) . ')';
|
||||
}
|
||||
$call_info{sub_name} = $sub_name;
|
||||
return wantarray() ? %call_info : \%call_info;
|
||||
}
|
||||
|
||||
# Transform an argument to a function into a string.
|
||||
our $in_recurse;
|
||||
sub format_arg {
|
||||
my $arg = shift;
|
||||
|
||||
if ( ref($arg) ) {
|
||||
# legitimate, let's not leak it.
|
||||
if (!$in_recurse &&
|
||||
do {
|
||||
local $@;
|
||||
local $in_recurse = 1;
|
||||
local $SIG{__DIE__} = sub{};
|
||||
eval {$arg->can('CARP_TRACE') }
|
||||
})
|
||||
{
|
||||
return $arg->CARP_TRACE();
|
||||
}
|
||||
elsif (!$in_recurse &&
|
||||
defined($RefArgFormatter) &&
|
||||
do {
|
||||
local $@;
|
||||
local $in_recurse = 1;
|
||||
local $SIG{__DIE__} = sub{};
|
||||
eval {$arg = $RefArgFormatter->($arg); 1}
|
||||
})
|
||||
{
|
||||
return $arg;
|
||||
}
|
||||
else
|
||||
{
|
||||
my $sub = _fetch_sub(overload => 'StrVal');
|
||||
return $sub ? &$sub($arg) : "$arg";
|
||||
}
|
||||
}
|
||||
return "undef" if !defined($arg);
|
||||
downgrade($arg, 1);
|
||||
return $arg if !(UTF8_REGEXP_PROBLEM && is_utf8($arg)) &&
|
||||
$arg =~ /\A-?[0-9]+(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?\z/;
|
||||
my $suffix = "";
|
||||
if ( 2 < $MaxArgLen and $MaxArgLen < length($arg) ) {
|
||||
substr ( $arg, $MaxArgLen - 3 ) = "";
|
||||
$suffix = "...";
|
||||
}
|
||||
if(UTF8_REGEXP_PROBLEM && is_utf8($arg)) {
|
||||
for(my $i = length($arg); $i--; ) {
|
||||
my $c = substr($arg, $i, 1);
|
||||
my $x = substr($arg, 0, 0); # work around bug on Perl 5.8.{1,2}
|
||||
if($c eq "\"" || $c eq "\\" || $c eq "\$" || $c eq "\@") {
|
||||
substr $arg, $i, 0, "\\";
|
||||
next;
|
||||
}
|
||||
my $o = ord($c);
|
||||
|
||||
# This code is repeated in Regexp::CARP_TRACE()
|
||||
if ($] ge 5.007_003) {
|
||||
substr $arg, $i, 1, sprintf("\\x{%x}", $o)
|
||||
if utf8::native_to_unicode($o) < utf8::native_to_unicode(0x20)
|
||||
|| utf8::native_to_unicode($o) > utf8::native_to_unicode(0x7e);
|
||||
} elsif (ord("A") == 65) {
|
||||
substr $arg, $i, 1, sprintf("\\x{%x}", $o)
|
||||
if $o < 0x20 || $o > 0x7e;
|
||||
} else { # Early EBCDIC
|
||||
|
||||
# 3 EBCDIC code pages supported then; all controls but one
|
||||
# are the code points below SPACE. The other one is 0x5F on
|
||||
# POSIX-BC; FF on the other two.
|
||||
substr $arg, $i, 1, sprintf("\\x{%x}", $o)
|
||||
if $o < ord(" ") || ((ord ("^") == 106)
|
||||
? $o == 0x5f
|
||||
: $o == 0xff);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$arg =~ s/([\"\\\$\@])/\\$1/g;
|
||||
# This is all the ASCII printables spelled-out. It is portable to all
|
||||
# Perl versions and platforms (such as EBCDIC). There are other more
|
||||
# compact ways to do this, but may not work everywhere every version.
|
||||
$arg =~ s/([^ !"\$\%#'()*+,\-.\/0123456789:;<=>?\@ABCDEFGHIJKLMNOPQRSTUVWXYZ\[\\\]^_`abcdefghijklmnopqrstuvwxyz\{|}~])/sprintf("\\x{%x}",ord($1))/eg;
|
||||
}
|
||||
downgrade($arg, 1);
|
||||
return "\"".$arg."\"".$suffix;
|
||||
}
|
||||
|
||||
sub Regexp::CARP_TRACE {
|
||||
my $arg = "$_[0]";
|
||||
downgrade($arg, 1);
|
||||
if(UTF8_REGEXP_PROBLEM && is_utf8($arg)) {
|
||||
for(my $i = length($arg); $i--; ) {
|
||||
my $o = ord(substr($arg, $i, 1));
|
||||
my $x = substr($arg, 0, 0); # work around bug on Perl 5.8.{1,2}
|
||||
|
||||
# This code is repeated in format_arg()
|
||||
if ($] ge 5.007_003) {
|
||||
substr $arg, $i, 1, sprintf("\\x{%x}", $o)
|
||||
if utf8::native_to_unicode($o) < utf8::native_to_unicode(0x20)
|
||||
|| utf8::native_to_unicode($o) > utf8::native_to_unicode(0x7e);
|
||||
} elsif (ord("A") == 65) {
|
||||
substr $arg, $i, 1, sprintf("\\x{%x}", $o)
|
||||
if $o < 0x20 || $o > 0x7e;
|
||||
} else { # Early EBCDIC
|
||||
substr $arg, $i, 1, sprintf("\\x{%x}", $o)
|
||||
if $o < ord(" ") || ((ord ("^") == 106)
|
||||
? $o == 0x5f
|
||||
: $o == 0xff);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
# See comment in format_arg() about this same regex.
|
||||
$arg =~ s/([^ !"\$\%#'()*+,\-.\/0123456789:;<=>?\@ABCDEFGHIJKLMNOPQRSTUVWXYZ\[\\\]^_`abcdefghijklmnopqrstuvwxyz\{|}~])/sprintf("\\x{%x}",ord($1))/eg;
|
||||
}
|
||||
downgrade($arg, 1);
|
||||
my $suffix = "";
|
||||
if($arg =~ /\A\(\?\^?([a-z]*)(?:-[a-z]*)?:(.*)\)\z/s) {
|
||||
($suffix, $arg) = ($1, $2);
|
||||
}
|
||||
if ( 2 < $MaxArgLen and $MaxArgLen < length($arg) ) {
|
||||
substr ( $arg, $MaxArgLen - 3 ) = "";
|
||||
$suffix = "...".$suffix;
|
||||
}
|
||||
return "qr($arg)$suffix";
|
||||
}
|
||||
|
||||
# Takes an inheritance cache and a package and returns
|
||||
# an anon hash of known inheritances and anon array of
|
||||
# inheritances which consequences have not been figured
|
||||
# for.
|
||||
sub get_status {
|
||||
my $cache = shift;
|
||||
my $pkg = shift;
|
||||
$cache->{$pkg} ||= [ { $pkg => $pkg }, [ trusts_directly($pkg) ] ];
|
||||
return @{ $cache->{$pkg} };
|
||||
}
|
||||
|
||||
# Takes the info from caller() and figures out the name of
|
||||
# the sub/require/eval
|
||||
sub get_subname {
|
||||
my $info = shift;
|
||||
if ( defined( $info->{evaltext} ) ) {
|
||||
my $eval = $info->{evaltext};
|
||||
if ( $info->{is_require} ) {
|
||||
return "require $eval";
|
||||
}
|
||||
else {
|
||||
$eval =~ s/([\\\'])/\\$1/g;
|
||||
return "eval '" . str_len_trim( $eval, $MaxEvalLen ) . "'";
|
||||
}
|
||||
}
|
||||
|
||||
# this can happen on older perls when the sub (or the stash containing it)
|
||||
# has been deleted
|
||||
if ( !defined( $info->{sub} ) ) {
|
||||
return '__ANON__::__ANON__';
|
||||
}
|
||||
|
||||
return ( $info->{sub} eq '(eval)' ) ? 'eval {...}' : $info->{sub};
|
||||
}
|
||||
|
||||
# Figures out what call (from the point of view of the caller)
|
||||
# the long error backtrace should start at.
|
||||
sub long_error_loc {
|
||||
my $i;
|
||||
my $lvl = $CarpLevel;
|
||||
{
|
||||
++$i;
|
||||
my $cgc = _cgc();
|
||||
my @caller = $cgc ? $cgc->($i) : caller($i);
|
||||
my $pkg = $caller[0];
|
||||
unless ( defined($pkg) ) {
|
||||
|
||||
# This *shouldn't* happen.
|
||||
if (%Internal) {
|
||||
local %Internal;
|
||||
$i = long_error_loc();
|
||||
last;
|
||||
}
|
||||
elsif (defined $caller[2]) {
|
||||
# this can happen when the stash has been deleted
|
||||
# in that case, just assume that it's a reasonable place to
|
||||
# stop (the file and line data will still be intact in any
|
||||
# case) - the only issue is that we can't detect if the
|
||||
# deleted package was internal (so don't do that then)
|
||||
# -doy
|
||||
redo unless 0 > --$lvl;
|
||||
last;
|
||||
}
|
||||
else {
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
redo if $CarpInternal{$pkg};
|
||||
redo unless 0 > --$lvl;
|
||||
redo if $Internal{$pkg};
|
||||
}
|
||||
return $i - 1;
|
||||
}
|
||||
|
||||
sub longmess_heavy {
|
||||
if ( ref( $_[0] ) ) { # don't break references as exceptions
|
||||
return wantarray ? @_ : $_[0];
|
||||
}
|
||||
my $i = long_error_loc();
|
||||
return ret_backtrace( $i, @_ );
|
||||
}
|
||||
|
||||
# Returns a full stack backtrace starting from where it is
|
||||
# told.
|
||||
sub ret_backtrace {
|
||||
my ( $i, @error ) = @_;
|
||||
my $mess;
|
||||
my $err = join '', @error;
|
||||
$i++;
|
||||
|
||||
my $tid_msg = '';
|
||||
if ( defined &threads::tid ) {
|
||||
my $tid = threads->tid;
|
||||
$tid_msg = " thread $tid" if $tid;
|
||||
}
|
||||
|
||||
my %i = caller_info($i);
|
||||
$mess = "$err at $i{file} line $i{line}$tid_msg";
|
||||
if( defined $. ) {
|
||||
local $@ = '';
|
||||
local $SIG{__DIE__};
|
||||
eval {
|
||||
CORE::die;
|
||||
};
|
||||
if($@ =~ /^Died at .*(, <.*?> (?:line|chunk) \d+).$/ ) {
|
||||
$mess .= $1;
|
||||
}
|
||||
}
|
||||
$mess .= "\.\n";
|
||||
|
||||
while ( my %i = caller_info( ++$i ) ) {
|
||||
$mess .= "\t$i{sub_name} called at $i{file} line $i{line}$tid_msg\n";
|
||||
}
|
||||
|
||||
return $mess;
|
||||
}
|
||||
|
||||
sub ret_summary {
|
||||
my ( $i, @error ) = @_;
|
||||
my $err = join '', @error;
|
||||
$i++;
|
||||
|
||||
my $tid_msg = '';
|
||||
if ( defined &threads::tid ) {
|
||||
my $tid = threads->tid;
|
||||
$tid_msg = " thread $tid" if $tid;
|
||||
}
|
||||
|
||||
my %i = caller_info($i);
|
||||
return "$err at $i{file} line $i{line}$tid_msg\.\n";
|
||||
}
|
||||
|
||||
sub short_error_loc {
|
||||
# You have to create your (hash)ref out here, rather than defaulting it
|
||||
# inside trusts *on a lexical*, as you want it to persist across calls.
|
||||
# (You can default it on $_[2], but that gets messy)
|
||||
my $cache = {};
|
||||
my $i = 1;
|
||||
my $lvl = $CarpLevel;
|
||||
{
|
||||
my $cgc = _cgc();
|
||||
my $called = $cgc ? $cgc->($i) : caller($i);
|
||||
$i++;
|
||||
my $caller = $cgc ? $cgc->($i) : caller($i);
|
||||
|
||||
if (!defined($caller)) {
|
||||
my @caller = $cgc ? $cgc->($i) : caller($i);
|
||||
if (@caller) {
|
||||
# if there's no package but there is other caller info, then
|
||||
# the package has been deleted - treat this as a valid package
|
||||
# in this case
|
||||
redo if defined($called) && $CarpInternal{$called};
|
||||
redo unless 0 > --$lvl;
|
||||
last;
|
||||
}
|
||||
else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
redo if $Internal{$caller};
|
||||
redo if $CarpInternal{$caller};
|
||||
redo if $CarpInternal{$called};
|
||||
redo if trusts( $called, $caller, $cache );
|
||||
redo if trusts( $caller, $called, $cache );
|
||||
redo unless 0 > --$lvl;
|
||||
}
|
||||
return $i - 1;
|
||||
}
|
||||
|
||||
sub shortmess_heavy {
|
||||
return longmess_heavy(@_) if $Verbose;
|
||||
return @_ if ref( $_[0] ); # don't break references as exceptions
|
||||
my $i = short_error_loc();
|
||||
if ($i) {
|
||||
ret_summary( $i, @_ );
|
||||
}
|
||||
else {
|
||||
longmess_heavy(@_);
|
||||
}
|
||||
}
|
||||
|
||||
# If a string is too long, trims it with ...
|
||||
sub str_len_trim {
|
||||
my $str = shift;
|
||||
my $max = shift || 0;
|
||||
if ( 2 < $max and $max < length($str) ) {
|
||||
substr( $str, $max - 3 ) = '...';
|
||||
}
|
||||
return $str;
|
||||
}
|
||||
|
||||
# Takes two packages and an optional cache. Says whether the
|
||||
# first inherits from the second.
|
||||
#
|
||||
# Recursive versions of this have to work to avoid certain
|
||||
# possible endless loops, and when following long chains of
|
||||
# inheritance are less efficient.
|
||||
sub trusts {
|
||||
my $child = shift;
|
||||
my $parent = shift;
|
||||
my $cache = shift;
|
||||
my ( $known, $partial ) = get_status( $cache, $child );
|
||||
|
||||
# Figure out consequences until we have an answer
|
||||
while ( @$partial and not exists $known->{$parent} ) {
|
||||
my $anc = shift @$partial;
|
||||
next if exists $known->{$anc};
|
||||
$known->{$anc}++;
|
||||
my ( $anc_knows, $anc_partial ) = get_status( $cache, $anc );
|
||||
my @found = keys %$anc_knows;
|
||||
@$known{@found} = ();
|
||||
push @$partial, @$anc_partial;
|
||||
}
|
||||
return exists $known->{$parent};
|
||||
}
|
||||
|
||||
# Takes a package and gives a list of those trusted directly
|
||||
sub trusts_directly {
|
||||
my $class = shift;
|
||||
no strict 'refs';
|
||||
my $stash = \%{"$class\::"};
|
||||
for my $var (qw/ CARP_NOT ISA /) {
|
||||
# Don't try using the variable until we know it exists,
|
||||
# to avoid polluting the caller's namespace.
|
||||
if ( $stash->{$var} && *{$stash->{$var}}{ARRAY} && @{$stash->{$var}} ) {
|
||||
return @{$stash->{$var}}
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if(!defined($warnings::VERSION) ||
|
||||
do { no warnings "numeric"; $warnings::VERSION < 1.03 }) {
|
||||
# Very old versions of warnings.pm import from Carp. This can go
|
||||
# wrong due to the circular dependency. If Carp is invoked before
|
||||
# warnings, then Carp starts by loading warnings, then warnings
|
||||
# tries to import from Carp, and gets nothing because Carp is in
|
||||
# the process of loading and hasn't defined its import method yet.
|
||||
# So we work around that by manually exporting to warnings here.
|
||||
no strict "refs";
|
||||
*{"warnings::$_"} = \&$_ foreach @EXPORT;
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
package Carp::Heavy;
|
||||
|
||||
use Carp ();
|
||||
|
||||
our $VERSION = '1.42';
|
||||
$VERSION =~ tr/_//d;
|
||||
|
||||
# Carp::Heavy was merged into Carp in version 1.12. Any mismatched versions
|
||||
# after this point are not significant and can be ignored.
|
||||
if(($Carp::VERSION || 0) < 1.12) {
|
||||
my $cv = defined($Carp::VERSION) ? $Carp::VERSION : "undef";
|
||||
die "Version mismatch between Carp $cv ($INC{q(Carp.pm)}) and Carp::Heavy $VERSION ($INC{q(Carp/Heavy.pm)}). Did you alter \@INC after Carp was loaded?\n";
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
# Most of the machinery of Carp used to be here.
|
||||
# It has been moved in Carp.pm now, but this placeholder remains for
|
||||
# the benefit of modules that like to preload Carp::Heavy directly.
|
||||
# This must load Carp, because some modules rely on the historical
|
||||
# behaviour of Carp::Heavy loading Carp.
|
|
@ -0,0 +1,111 @@
|
|||
# This file was created by configpm when Perl was built. Any changes
|
||||
# made to this file will be lost the next time perl is built.
|
||||
|
||||
# for a description of the variables, please have a look at the
|
||||
# Glossary file, as written in the Porting folder, or use the url:
|
||||
# http://perl5.git.perl.org/perl.git/blob/HEAD:/Porting/Glossary
|
||||
|
||||
package Config;
|
||||
use strict;
|
||||
use warnings;
|
||||
use vars '%Config', '$VERSION';
|
||||
|
||||
$VERSION = "5.026001";
|
||||
|
||||
# Skip @Config::EXPORT because it only contains %Config, which we special
|
||||
# case below as it's not a function. @Config::EXPORT won't change in the
|
||||
# lifetime of Perl 5.
|
||||
my %Export_Cache = (myconfig => 1, config_sh => 1, config_vars => 1,
|
||||
config_re => 1, compile_date => 1, local_patches => 1,
|
||||
bincompat_options => 1, non_bincompat_options => 1,
|
||||
header_files => 1);
|
||||
|
||||
@Config::EXPORT = qw(%Config);
|
||||
@Config::EXPORT_OK = keys %Export_Cache;
|
||||
|
||||
# Need to stub all the functions to make code such as print Config::config_sh
|
||||
# keep working
|
||||
|
||||
sub bincompat_options;
|
||||
sub compile_date;
|
||||
sub config_re;
|
||||
sub config_sh;
|
||||
sub config_vars;
|
||||
sub header_files;
|
||||
sub local_patches;
|
||||
sub myconfig;
|
||||
sub non_bincompat_options;
|
||||
|
||||
# Define our own import method to avoid pulling in the full Exporter:
|
||||
sub import {
|
||||
shift;
|
||||
@_ = @Config::EXPORT unless @_;
|
||||
|
||||
my @funcs = grep $_ ne '%Config', @_;
|
||||
my $export_Config = @funcs < @_ ? 1 : 0;
|
||||
|
||||
no strict 'refs';
|
||||
my $callpkg = caller(0);
|
||||
foreach my $func (@funcs) {
|
||||
die qq{"$func" is not exported by the Config module\n}
|
||||
unless $Export_Cache{$func};
|
||||
*{$callpkg.'::'.$func} = \&{$func};
|
||||
}
|
||||
|
||||
*{"$callpkg\::Config"} = \%Config if $export_Config;
|
||||
return;
|
||||
}
|
||||
|
||||
die "$0: Perl lib version (5.26.1) doesn't match executable '$^X' version ($])"
|
||||
unless $^V;
|
||||
|
||||
$^V eq 5.26.1
|
||||
or die sprintf "%s: Perl lib version (5.26.1) doesn't match executable '$^X' version (%vd)", $0, $^V;
|
||||
|
||||
|
||||
sub FETCH {
|
||||
my($self, $key) = @_;
|
||||
|
||||
# check for cached value (which may be undef so we use exists not defined)
|
||||
return exists $self->{$key} ? $self->{$key} : $self->fetch_string($key);
|
||||
}
|
||||
|
||||
sub TIEHASH {
|
||||
bless $_[1], $_[0];
|
||||
}
|
||||
|
||||
sub DESTROY { }
|
||||
|
||||
sub AUTOLOAD {
|
||||
require 'Config_heavy.pl';
|
||||
goto \&launcher unless $Config::AUTOLOAD =~ /launcher$/;
|
||||
die "&Config::AUTOLOAD failed on $Config::AUTOLOAD";
|
||||
}
|
||||
|
||||
# tie returns the object, so the value returned to require will be true.
|
||||
tie %Config, 'Config', {
|
||||
archlibexp => '/usr/lib/x86_64-linux-gnu/perl/5.26',
|
||||
archname => 'x86_64-linux-gnu-thread-multi',
|
||||
cc => 'x86_64-linux-gnu-gcc',
|
||||
d_readlink => 'define',
|
||||
d_symlink => 'define',
|
||||
dlext => 'so',
|
||||
dlsrc => 'dl_dlopen.xs',
|
||||
dont_use_nlink => undef,
|
||||
exe_ext => '',
|
||||
inc_version_list => '5.26.0 5.26.0/x86_64-linux-gnu-thread-multi',
|
||||
intsize => '4',
|
||||
ldlibpthname => 'LD_LIBRARY_PATH',
|
||||
libpth => '/usr/local/lib /usr/lib/gcc/x86_64-linux-gnu/7/include-fixed /usr/include/x86_64-linux-gnu /usr/lib /lib/x86_64-linux-gnu /lib/../lib /usr/lib/x86_64-linux-gnu /usr/lib/../lib /lib',
|
||||
osname => 'linux',
|
||||
osvers => '4.9.0',
|
||||
path_sep => ':',
|
||||
privlibexp => '/usr/share/perl/5.26',
|
||||
scriptdir => '/usr/bin',
|
||||
sitearchexp => '/usr/local/lib/x86_64-linux-gnu/perl/5.26.1',
|
||||
sitelibexp => '/usr/local/share/perl/5.26.1',
|
||||
so => 'so',
|
||||
useithreads => 'define',
|
||||
usevendorprefix => 'define',
|
||||
version => '5.26.1',
|
||||
};
|
|
@ -0,0 +1,12 @@
|
|||
######################################################################
|
||||
# WARNING: 'lib/Config_git.pl' is generated by make_patchnum.pl
|
||||
# DO NOT EDIT DIRECTLY - edit make_patchnum.pl instead
|
||||
######################################################################
|
||||
$Config::Git_Data=<<'ENDOFGIT';
|
||||
git_commit_id=''
|
||||
git_describe=''
|
||||
git_branch=''
|
||||
git_uncommitted_changes=''
|
||||
git_commit_id_title=''
|
||||
|
||||
ENDOFGIT
|
|
@ -0,0 +1,697 @@
|
|||
package Cwd;
|
||||
use strict;
|
||||
use Exporter;
|
||||
use vars qw(@ISA @EXPORT @EXPORT_OK $VERSION);
|
||||
|
||||
$VERSION = '3.67';
|
||||
my $xs_version = $VERSION;
|
||||
$VERSION =~ tr/_//d;
|
||||
|
||||
@ISA = qw/ Exporter /;
|
||||
@EXPORT = qw(cwd getcwd fastcwd fastgetcwd);
|
||||
push @EXPORT, qw(getdcwd) if $^O eq 'MSWin32';
|
||||
@EXPORT_OK = qw(chdir abs_path fast_abs_path realpath fast_realpath);
|
||||
|
||||
# sys_cwd may keep the builtin command
|
||||
|
||||
# All the functionality of this module may provided by builtins,
|
||||
# there is no sense to process the rest of the file.
|
||||
# The best choice may be to have this in BEGIN, but how to return from BEGIN?
|
||||
|
||||
if ($^O eq 'os2') {
|
||||
local $^W = 0;
|
||||
|
||||
*cwd = defined &sys_cwd ? \&sys_cwd : \&_os2_cwd;
|
||||
*getcwd = \&cwd;
|
||||
*fastgetcwd = \&cwd;
|
||||
*fastcwd = \&cwd;
|
||||
|
||||
*fast_abs_path = \&sys_abspath if defined &sys_abspath;
|
||||
*abs_path = \&fast_abs_path;
|
||||
*realpath = \&fast_abs_path;
|
||||
*fast_realpath = \&fast_abs_path;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
# Need to look up the feature settings on VMS. The preferred way is to use the
|
||||
# VMS::Feature module, but that may not be available to dual life modules.
|
||||
|
||||
my $use_vms_feature;
|
||||
BEGIN {
|
||||
if ($^O eq 'VMS') {
|
||||
if (eval { local $SIG{__DIE__};
|
||||
local @INC = @INC;
|
||||
pop @INC if $INC[-1] eq '.';
|
||||
require VMS::Feature; }) {
|
||||
$use_vms_feature = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# Need to look up the UNIX report mode. This may become a dynamic mode
|
||||
# in the future.
|
||||
sub _vms_unix_rpt {
|
||||
my $unix_rpt;
|
||||
if ($use_vms_feature) {
|
||||
$unix_rpt = VMS::Feature::current("filename_unix_report");
|
||||
} else {
|
||||
my $env_unix_rpt = $ENV{'DECC$FILENAME_UNIX_REPORT'} || '';
|
||||
$unix_rpt = $env_unix_rpt =~ /^[ET1]/i;
|
||||
}
|
||||
return $unix_rpt;
|
||||
}
|
||||
|
||||
# Need to look up the EFS character set mode. This may become a dynamic
|
||||
# mode in the future.
|
||||
sub _vms_efs {
|
||||
my $efs;
|
||||
if ($use_vms_feature) {
|
||||
$efs = VMS::Feature::current("efs_charset");
|
||||
} else {
|
||||
my $env_efs = $ENV{'DECC$EFS_CHARSET'} || '';
|
||||
$efs = $env_efs =~ /^[ET1]/i;
|
||||
}
|
||||
return $efs;
|
||||
}
|
||||
|
||||
# If loading the XS stuff doesn't work, we can fall back to pure perl
|
||||
if(! defined &getcwd && defined &DynaLoader::boot_DynaLoader) {
|
||||
eval {#eval is questionable since we are handling potential errors like
|
||||
#"Cwd object version 3.48 does not match bootstrap parameter 3.50
|
||||
#at lib/DynaLoader.pm line 216." by having this eval
|
||||
if ( $] >= 5.006 ) {
|
||||
require XSLoader;
|
||||
XSLoader::load( __PACKAGE__, $xs_version);
|
||||
} else {
|
||||
require DynaLoader;
|
||||
push @ISA, 'DynaLoader';
|
||||
__PACKAGE__->bootstrap( $xs_version );
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
# Big nasty table of function aliases
|
||||
my %METHOD_MAP =
|
||||
(
|
||||
VMS =>
|
||||
{
|
||||
cwd => '_vms_cwd',
|
||||
getcwd => '_vms_cwd',
|
||||
fastcwd => '_vms_cwd',
|
||||
fastgetcwd => '_vms_cwd',
|
||||
abs_path => '_vms_abs_path',
|
||||
fast_abs_path => '_vms_abs_path',
|
||||
},
|
||||
|
||||
MSWin32 =>
|
||||
{
|
||||
# We assume that &_NT_cwd is defined as an XSUB or in the core.
|
||||
cwd => '_NT_cwd',
|
||||
getcwd => '_NT_cwd',
|
||||
fastcwd => '_NT_cwd',
|
||||
fastgetcwd => '_NT_cwd',
|
||||
abs_path => 'fast_abs_path',
|
||||
realpath => 'fast_abs_path',
|
||||
},
|
||||
|
||||
dos =>
|
||||
{
|
||||
cwd => '_dos_cwd',
|
||||
getcwd => '_dos_cwd',
|
||||
fastgetcwd => '_dos_cwd',
|
||||
fastcwd => '_dos_cwd',
|
||||
abs_path => 'fast_abs_path',
|
||||
},
|
||||
|
||||
# QNX4. QNX6 has a $os of 'nto'.
|
||||
qnx =>
|
||||
{
|
||||
cwd => '_qnx_cwd',
|
||||
getcwd => '_qnx_cwd',
|
||||
fastgetcwd => '_qnx_cwd',
|
||||
fastcwd => '_qnx_cwd',
|
||||
abs_path => '_qnx_abs_path',
|
||||
fast_abs_path => '_qnx_abs_path',
|
||||
},
|
||||
|
||||
cygwin =>
|
||||
{
|
||||
getcwd => 'cwd',
|
||||
fastgetcwd => 'cwd',
|
||||
fastcwd => 'cwd',
|
||||
abs_path => 'fast_abs_path',
|
||||
realpath => 'fast_abs_path',
|
||||
},
|
||||
|
||||
epoc =>
|
||||
{
|
||||
cwd => '_epoc_cwd',
|
||||
getcwd => '_epoc_cwd',
|
||||
fastgetcwd => '_epoc_cwd',
|
||||
fastcwd => '_epoc_cwd',
|
||||
abs_path => 'fast_abs_path',
|
||||
},
|
||||
|
||||
MacOS =>
|
||||
{
|
||||
getcwd => 'cwd',
|
||||
fastgetcwd => 'cwd',
|
||||
fastcwd => 'cwd',
|
||||
abs_path => 'fast_abs_path',
|
||||
},
|
||||
|
||||
amigaos =>
|
||||
{
|
||||
getcwd => '_backtick_pwd',
|
||||
fastgetcwd => '_backtick_pwd',
|
||||
fastcwd => '_backtick_pwd',
|
||||
abs_path => 'fast_abs_path',
|
||||
}
|
||||
);
|
||||
|
||||
$METHOD_MAP{NT} = $METHOD_MAP{MSWin32};
|
||||
|
||||
# Find the pwd command in the expected locations. We assume these
|
||||
# are safe. This prevents _backtick_pwd() consulting $ENV{PATH}
|
||||
# so everything works under taint mode.
|
||||
my $pwd_cmd;
|
||||
if($^O ne 'MSWin32') {
|
||||
foreach my $try ('/bin/pwd',
|
||||
'/usr/bin/pwd',
|
||||
'/QOpenSys/bin/pwd', # OS/400 PASE.
|
||||
) {
|
||||
if( -x $try ) {
|
||||
$pwd_cmd = $try;
|
||||
last;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# Android has a built-in pwd. Using $pwd_cmd will DTRT if
|
||||
# this perl was compiled with -Dd_useshellcmds, which is the
|
||||
# default for Android, but the block below is needed for the
|
||||
# miniperl running on the host when cross-compiling, and
|
||||
# potentially for native builds with -Ud_useshellcmds.
|
||||
if ($^O =~ /android/) {
|
||||
# If targetsh is executable, then we're either a full
|
||||
# perl, or a miniperl for a native build.
|
||||
if (-x $Config::Config{targetsh}) {
|
||||
$pwd_cmd = "$Config::Config{targetsh} -c pwd"
|
||||
}
|
||||
else {
|
||||
my $sh = $Config::Config{sh} || (-x '/system/bin/sh' ? '/system/bin/sh' : 'sh');
|
||||
$pwd_cmd = "$sh -c pwd"
|
||||
}
|
||||
}
|
||||
|
||||
my $found_pwd_cmd = defined($pwd_cmd);
|
||||
unless ($pwd_cmd) {
|
||||
# Isn't this wrong? _backtick_pwd() will fail if someone has
|
||||
# pwd in their path but it is not /bin/pwd or /usr/bin/pwd?
|
||||
# See [perl #16774]. --jhi
|
||||
$pwd_cmd = 'pwd';
|
||||
}
|
||||
|
||||
# Lazy-load Carp
|
||||
sub _carp { require Carp; Carp::carp(@_) }
|
||||
sub _croak { require Carp; Carp::croak(@_) }
|
||||
|
||||
# The 'natural and safe form' for UNIX (pwd may be setuid root)
|
||||
sub _backtick_pwd {
|
||||
|
||||
# Localize %ENV entries in a way that won't create new hash keys.
|
||||
# Under AmigaOS we don't want to localize as it stops perl from
|
||||
# finding 'sh' in the PATH.
|
||||
my @localize = grep exists $ENV{$_}, qw(PATH IFS CDPATH ENV BASH_ENV) if $^O ne "amigaos";
|
||||
local @ENV{@localize} if @localize;
|
||||
|
||||
my $cwd = `$pwd_cmd`;
|
||||
# Belt-and-suspenders in case someone said "undef $/".
|
||||
local $/ = "\n";
|
||||
# `pwd` may fail e.g. if the disk is full
|
||||
chomp($cwd) if defined $cwd;
|
||||
$cwd;
|
||||
}
|
||||
|
||||
# Since some ports may predefine cwd internally (e.g., NT)
|
||||
# we take care not to override an existing definition for cwd().
|
||||
|
||||
unless ($METHOD_MAP{$^O}{cwd} or defined &cwd) {
|
||||
# The pwd command is not available in some chroot(2)'ed environments
|
||||
my $sep = $Config::Config{path_sep} || ':';
|
||||
my $os = $^O; # Protect $^O from tainting
|
||||
|
||||
# Try again to find a pwd, this time searching the whole PATH.
|
||||
if (defined $ENV{PATH} and $os ne 'MSWin32') { # no pwd on Windows
|
||||
my @candidates = split($sep, $ENV{PATH});
|
||||
while (!$found_pwd_cmd and @candidates) {
|
||||
my $candidate = shift @candidates;
|
||||
$found_pwd_cmd = 1 if -x "$candidate/pwd";
|
||||
}
|
||||
}
|
||||
|
||||
# MacOS has some special magic to make `pwd` work.
|
||||
if( $os eq 'MacOS' || $found_pwd_cmd )
|
||||
{
|
||||
*cwd = \&_backtick_pwd;
|
||||
}
|
||||
else {
|
||||
*cwd = \&getcwd;
|
||||
}
|
||||
}
|
||||
|
||||
if ($^O eq 'cygwin') {
|
||||
# We need to make sure cwd() is called with no args, because it's
|
||||
# got an arg-less prototype and will die if args are present.
|
||||
local $^W = 0;
|
||||
my $orig_cwd = \&cwd;
|
||||
*cwd = sub { &$orig_cwd() }
|
||||
}
|
||||
|
||||
# set a reasonable (and very safe) default for fastgetcwd, in case it
|
||||
# isn't redefined later (20001212 rspier)
|
||||
*fastgetcwd = \&cwd;
|
||||
|
||||
# A non-XS version of getcwd() - also used to bootstrap the perl build
|
||||
# process, when miniperl is running and no XS loading happens.
|
||||
sub _perl_getcwd
|
||||
{
|
||||
abs_path('.');
|
||||
}
|
||||
|
||||
# By John Bazik
|
||||
#
|
||||
# Usage: $cwd = &fastcwd;
|
||||
#
|
||||
# This is a faster version of getcwd. It's also more dangerous because
|
||||
# you might chdir out of a directory that you can't chdir back into.
|
||||
|
||||
sub fastcwd_ {
|
||||
my($odev, $oino, $cdev, $cino, $tdev, $tino);
|
||||
my(@path, $path);
|
||||
local(*DIR);
|
||||
|
||||
my($orig_cdev, $orig_cino) = stat('.');
|
||||
($cdev, $cino) = ($orig_cdev, $orig_cino);
|
||||
for (;;) {
|
||||
my $direntry;
|
||||
($odev, $oino) = ($cdev, $cino);
|
||||
CORE::chdir('..') || return undef;
|
||||
($cdev, $cino) = stat('.');
|
||||
last if $odev == $cdev && $oino == $cino;
|
||||
opendir(DIR, '.') || return undef;
|
||||
for (;;) {
|
||||
$direntry = readdir(DIR);
|
||||
last unless defined $direntry;
|
||||
next if $direntry eq '.';
|
||||
next if $direntry eq '..';
|
||||
|
||||
($tdev, $tino) = lstat($direntry);
|
||||
last unless $tdev != $odev || $tino != $oino;
|
||||
}
|
||||
closedir(DIR);
|
||||
return undef unless defined $direntry; # should never happen
|
||||
unshift(@path, $direntry);
|
||||
}
|
||||
$path = '/' . join('/', @path);
|
||||
if ($^O eq 'apollo') { $path = "/".$path; }
|
||||
# At this point $path may be tainted (if tainting) and chdir would fail.
|
||||
# Untaint it then check that we landed where we started.
|
||||
$path =~ /^(.*)\z/s # untaint
|
||||
&& CORE::chdir($1) or return undef;
|
||||
($cdev, $cino) = stat('.');
|
||||
die "Unstable directory path, current directory changed unexpectedly"
|
||||
if $cdev != $orig_cdev || $cino != $orig_cino;
|
||||
$path;
|
||||
}
|
||||
if (not defined &fastcwd) { *fastcwd = \&fastcwd_ }
|
||||
|
||||
# Keeps track of current working directory in PWD environment var
|
||||
# Usage:
|
||||
# use Cwd 'chdir';
|
||||
# chdir $newdir;
|
||||
|
||||
my $chdir_init = 0;
|
||||
|
||||
sub chdir_init {
|
||||
if ($ENV{'PWD'} and $^O ne 'os2' and $^O ne 'dos' and $^O ne 'MSWin32') {
|
||||
my($dd,$di) = stat('.');
|
||||
my($pd,$pi) = stat($ENV{'PWD'});
|
||||
if (!defined $dd or !defined $pd or $di != $pi or $dd != $pd) {
|
||||
$ENV{'PWD'} = cwd();
|
||||
}
|
||||
}
|
||||
else {
|
||||
my $wd = cwd();
|
||||
$wd = Win32::GetFullPathName($wd) if $^O eq 'MSWin32';
|
||||
$ENV{'PWD'} = $wd;
|
||||
}
|
||||
# Strip an automounter prefix (where /tmp_mnt/foo/bar == /foo/bar)
|
||||
if ($^O ne 'MSWin32' and $ENV{'PWD'} =~ m|(/[^/]+(/[^/]+/[^/]+))(.*)|s) {
|
||||
my($pd,$pi) = stat($2);
|
||||
my($dd,$di) = stat($1);
|
||||
if (defined $pd and defined $dd and $di == $pi and $dd == $pd) {
|
||||
$ENV{'PWD'}="$2$3";
|
||||
}
|
||||
}
|
||||
$chdir_init = 1;
|
||||
}
|
||||
|
||||
sub chdir {
|
||||
my $newdir = @_ ? shift : ''; # allow for no arg (chdir to HOME dir)
|
||||
if ($^O eq "cygwin") {
|
||||
$newdir =~ s|\A///+|//|;
|
||||
$newdir =~ s|(?<=[^/])//+|/|g;
|
||||
}
|
||||
elsif ($^O ne 'MSWin32') {
|
||||
$newdir =~ s|///*|/|g;
|
||||
}
|
||||
chdir_init() unless $chdir_init;
|
||||
my $newpwd;
|
||||
if ($^O eq 'MSWin32') {
|
||||
# get the full path name *before* the chdir()
|
||||
$newpwd = Win32::GetFullPathName($newdir);
|
||||
}
|
||||
|
||||
return 0 unless CORE::chdir $newdir;
|
||||
|
||||
if ($^O eq 'VMS') {
|
||||
return $ENV{'PWD'} = $ENV{'DEFAULT'}
|
||||
}
|
||||
elsif ($^O eq 'MacOS') {
|
||||
return $ENV{'PWD'} = cwd();
|
||||
}
|
||||
elsif ($^O eq 'MSWin32') {
|
||||
$ENV{'PWD'} = $newpwd;
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (ref $newdir eq 'GLOB') { # in case a file/dir handle is passed in
|
||||
$ENV{'PWD'} = cwd();
|
||||
} elsif ($newdir =~ m#^/#s) {
|
||||
$ENV{'PWD'} = $newdir;
|
||||
} else {
|
||||
my @curdir = split(m#/#,$ENV{'PWD'});
|
||||
@curdir = ('') unless @curdir;
|
||||
my $component;
|
||||
foreach $component (split(m#/#, $newdir)) {
|
||||
next if $component eq '.';
|
||||
pop(@curdir),next if $component eq '..';
|
||||
push(@curdir,$component);
|
||||
}
|
||||
$ENV{'PWD'} = join('/',@curdir) || '/';
|
||||
}
|
||||
1;
|
||||
}
|
||||
|
||||
sub _perl_abs_path
|
||||
{
|
||||
my $start = @_ ? shift : '.';
|
||||
my($dotdots, $cwd, @pst, @cst, $dir, @tst);
|
||||
|
||||
unless (@cst = stat( $start ))
|
||||
{
|
||||
_carp("stat($start): $!");
|
||||
return '';
|
||||
}
|
||||
|
||||
unless (-d _) {
|
||||
# Make sure we can be invoked on plain files, not just directories.
|
||||
# NOTE that this routine assumes that '/' is the only directory separator.
|
||||
|
||||
my ($dir, $file) = $start =~ m{^(.*)/(.+)$}
|
||||
or return cwd() . '/' . $start;
|
||||
|
||||
# Can't use "-l _" here, because the previous stat was a stat(), not an lstat().
|
||||
if (-l $start) {
|
||||
my $link_target = readlink($start);
|
||||
die "Can't resolve link $start: $!" unless defined $link_target;
|
||||
|
||||
require File::Spec;
|
||||
$link_target = $dir . '/' . $link_target
|
||||
unless File::Spec->file_name_is_absolute($link_target);
|
||||
|
||||
return abs_path($link_target);
|
||||
}
|
||||
|
||||
return $dir ? abs_path($dir) . "/$file" : "/$file";
|
||||
}
|
||||
|
||||
$cwd = '';
|
||||
$dotdots = $start;
|
||||
do
|
||||
{
|
||||
$dotdots .= '/..';
|
||||
@pst = @cst;
|
||||
local *PARENT;
|
||||
unless (opendir(PARENT, $dotdots))
|
||||
{
|
||||
# probably a permissions issue. Try the native command.
|
||||
require File::Spec;
|
||||
return File::Spec->rel2abs( $start, _backtick_pwd() );
|
||||
}
|
||||
unless (@cst = stat($dotdots))
|
||||
{
|
||||
_carp("stat($dotdots): $!");
|
||||
closedir(PARENT);
|
||||
return '';
|
||||
}
|
||||
if ($pst[0] == $cst[0] && $pst[1] == $cst[1])
|
||||
{
|
||||
$dir = undef;
|
||||
}
|
||||
else
|
||||
{
|
||||
do
|
||||
{
|
||||
unless (defined ($dir = readdir(PARENT)))
|
||||
{
|
||||
_carp("readdir($dotdots): $!");
|
||||
closedir(PARENT);
|
||||
return '';
|
||||
}
|
||||
$tst[0] = $pst[0]+1 unless (@tst = lstat("$dotdots/$dir"))
|
||||
}
|
||||
while ($dir eq '.' || $dir eq '..' || $tst[0] != $pst[0] ||
|
||||
$tst[1] != $pst[1]);
|
||||
}
|
||||
$cwd = (defined $dir ? "$dir" : "" ) . "/$cwd" ;
|
||||
closedir(PARENT);
|
||||
} while (defined $dir);
|
||||
chop($cwd) unless $cwd eq '/'; # drop the trailing /
|
||||
$cwd;
|
||||
}
|
||||
|
||||
my $Curdir;
|
||||
sub fast_abs_path {
|
||||
local $ENV{PWD} = $ENV{PWD} || ''; # Guard against clobberage
|
||||
my $cwd = getcwd();
|
||||
require File::Spec;
|
||||
my $path = @_ ? shift : ($Curdir ||= File::Spec->curdir);
|
||||
|
||||
# Detaint else we'll explode in taint mode. This is safe because
|
||||
# we're not doing anything dangerous with it.
|
||||
($path) = $path =~ /(.*)/s;
|
||||
($cwd) = $cwd =~ /(.*)/s;
|
||||
|
||||
unless (-e $path) {
|
||||
_croak("$path: No such file or directory");
|
||||
}
|
||||
|
||||
unless (-d _) {
|
||||
# Make sure we can be invoked on plain files, not just directories.
|
||||
|
||||
my ($vol, $dir, $file) = File::Spec->splitpath($path);
|
||||
return File::Spec->catfile($cwd, $path) unless length $dir;
|
||||
|
||||
if (-l $path) {
|
||||
my $link_target = readlink($path);
|
||||
die "Can't resolve link $path: $!" unless defined $link_target;
|
||||
|
||||
$link_target = File::Spec->catpath($vol, $dir, $link_target)
|
||||
unless File::Spec->file_name_is_absolute($link_target);
|
||||
|
||||
return fast_abs_path($link_target);
|
||||
}
|
||||
|
||||
return $dir eq File::Spec->rootdir
|
||||
? File::Spec->catpath($vol, $dir, $file)
|
||||
: fast_abs_path(File::Spec->catpath($vol, $dir, '')) . '/' . $file;
|
||||
}
|
||||
|
||||
if (!CORE::chdir($path)) {
|
||||
_croak("Cannot chdir to $path: $!");
|
||||
}
|
||||
my $realpath = getcwd();
|
||||
if (! ((-d $cwd) && (CORE::chdir($cwd)))) {
|
||||
_croak("Cannot chdir back to $cwd: $!");
|
||||
}
|
||||
$realpath;
|
||||
}
|
||||
|
||||
# added function alias to follow principle of least surprise
|
||||
# based on previous aliasing. --tchrist 27-Jan-00
|
||||
*fast_realpath = \&fast_abs_path;
|
||||
|
||||
# --- PORTING SECTION ---
|
||||
|
||||
# VMS: $ENV{'DEFAULT'} points to default directory at all times
|
||||
# 06-Mar-1996 Charles Bailey bailey@newman.upenn.edu
|
||||
# Note: Use of Cwd::chdir() causes the logical name PWD to be defined
|
||||
# in the process logical name table as the default device and directory
|
||||
# seen by Perl. This may not be the same as the default device
|
||||
# and directory seen by DCL after Perl exits, since the effects
|
||||
# the CRTL chdir() function persist only until Perl exits.
|
||||
|
||||
sub _vms_cwd {
|
||||
return $ENV{'DEFAULT'};
|
||||
}
|
||||
|
||||
sub _vms_abs_path {
|
||||
return $ENV{'DEFAULT'} unless @_;
|
||||
my $path = shift;
|
||||
|
||||
my $efs = _vms_efs;
|
||||
my $unix_rpt = _vms_unix_rpt;
|
||||
|
||||
if (defined &VMS::Filespec::vmsrealpath) {
|
||||
my $path_unix = 0;
|
||||
my $path_vms = 0;
|
||||
|
||||
$path_unix = 1 if ($path =~ m#(?<=\^)/#);
|
||||
$path_unix = 1 if ($path =~ /^\.\.?$/);
|
||||
$path_vms = 1 if ($path =~ m#[\[<\]]#);
|
||||
$path_vms = 1 if ($path =~ /^--?$/);
|
||||
|
||||
my $unix_mode = $path_unix;
|
||||
if ($efs) {
|
||||
# In case of a tie, the Unix report mode decides.
|
||||
if ($path_vms == $path_unix) {
|
||||
$unix_mode = $unix_rpt;
|
||||
} else {
|
||||
$unix_mode = 0 if $path_vms;
|
||||
}
|
||||
}
|
||||
|
||||
if ($unix_mode) {
|
||||
# Unix format
|
||||
return VMS::Filespec::unixrealpath($path);
|
||||
}
|
||||
|
||||
# VMS format
|
||||
|
||||
my $new_path = VMS::Filespec::vmsrealpath($path);
|
||||
|
||||
# Perl expects directories to be in directory format
|
||||
$new_path = VMS::Filespec::pathify($new_path) if -d $path;
|
||||
return $new_path;
|
||||
}
|
||||
|
||||
# Fallback to older algorithm if correct ones are not
|
||||
# available.
|
||||
|
||||
if (-l $path) {
|
||||
my $link_target = readlink($path);
|
||||
die "Can't resolve link $path: $!" unless defined $link_target;
|
||||
|
||||
return _vms_abs_path($link_target);
|
||||
}
|
||||
|
||||
# may need to turn foo.dir into [.foo]
|
||||
my $pathified = VMS::Filespec::pathify($path);
|
||||
$path = $pathified if defined $pathified;
|
||||
|
||||
return VMS::Filespec::rmsexpand($path);
|
||||
}
|
||||
|
||||
sub _os2_cwd {
|
||||
my $pwd = `cmd /c cd`;
|
||||
chomp $pwd;
|
||||
$pwd =~ s:\\:/:g ;
|
||||
$ENV{'PWD'} = $pwd;
|
||||
return $pwd;
|
||||
}
|
||||
|
||||
sub _win32_cwd_simple {
|
||||
my $pwd = `cd`;
|
||||
chomp $pwd;
|
||||
$pwd =~ s:\\:/:g ;
|
||||
$ENV{'PWD'} = $pwd;
|
||||
return $pwd;
|
||||
}
|
||||
|
||||
sub _win32_cwd {
|
||||
my $pwd;
|
||||
$pwd = Win32::GetCwd();
|
||||
$pwd =~ s:\\:/:g ;
|
||||
$ENV{'PWD'} = $pwd;
|
||||
return $pwd;
|
||||
}
|
||||
|
||||
*_NT_cwd = defined &Win32::GetCwd ? \&_win32_cwd : \&_win32_cwd_simple;
|
||||
|
||||
sub _dos_cwd {
|
||||
my $pwd;
|
||||
if (!defined &Dos::GetCwd) {
|
||||
chomp($pwd = `command /c cd`);
|
||||
$pwd =~ s:\\:/:g ;
|
||||
} else {
|
||||
$pwd = Dos::GetCwd();
|
||||
}
|
||||
$ENV{'PWD'} = $pwd;
|
||||
return $pwd;
|
||||
}
|
||||
|
||||
sub _qnx_cwd {
|
||||
local $ENV{PATH} = '';
|
||||
local $ENV{CDPATH} = '';
|
||||
local $ENV{ENV} = '';
|
||||
my $pwd = `/usr/bin/fullpath -t`;
|
||||
chomp $pwd;
|
||||
$ENV{'PWD'} = $pwd;
|
||||
return $pwd;
|
||||
}
|
||||
|
||||
sub _qnx_abs_path {
|
||||
local $ENV{PATH} = '';
|
||||
local $ENV{CDPATH} = '';
|
||||
local $ENV{ENV} = '';
|
||||
my $path = @_ ? shift : '.';
|
||||
local *REALPATH;
|
||||
|
||||
defined( open(REALPATH, '-|') || exec '/usr/bin/fullpath', '-t', $path ) or
|
||||
die "Can't open /usr/bin/fullpath: $!";
|
||||
my $realpath = <REALPATH>;
|
||||
close REALPATH;
|
||||
chomp $realpath;
|
||||
return $realpath;
|
||||
}
|
||||
|
||||
sub _epoc_cwd {
|
||||
return $ENV{'PWD'} = EPOC::getcwd();
|
||||
}
|
||||
|
||||
# Now that all the base-level functions are set up, alias the
|
||||
# user-level functions to the right places
|
||||
|
||||
if (exists $METHOD_MAP{$^O}) {
|
||||
my $map = $METHOD_MAP{$^O};
|
||||
foreach my $name (keys %$map) {
|
||||
local $^W = 0; # assignments trigger 'subroutine redefined' warning
|
||||
no strict 'refs';
|
||||
*{$name} = \&{$map->{$name}};
|
||||
}
|
||||
}
|
||||
|
||||
# In case the XS version doesn't load.
|
||||
*abs_path = \&_perl_abs_path unless defined &abs_path;
|
||||
*getcwd = \&_perl_getcwd unless defined &getcwd;
|
||||
|
||||
# added function alias for those of us more
|
||||
# used to the libc function. --tchrist 27-Jan-00
|
||||
*realpath = \&abs_path;
|
||||
|
||||
1;
|
||||
__END__
|
||||
|
|
@ -0,0 +1,314 @@
|
|||
# Generated from DynaLoader_pm.PL, this file is unique for every OS
|
||||
|
||||
package DynaLoader;
|
||||
|
||||
# And Gandalf said: 'Many folk like to know beforehand what is to
|
||||
# be set on the table; but those who have laboured to prepare the
|
||||
# feast like to keep their secret; for wonder makes the words of
|
||||
# praise louder.'
|
||||
|
||||
# (Quote from Tolkien suggested by Anno Siegel.)
|
||||
#
|
||||
# See pod text at end of file for documentation.
|
||||
# See also ext/DynaLoader/README in source tree for other information.
|
||||
#
|
||||
# Tim.Bunce@ig.co.uk, August 1994
|
||||
|
||||
BEGIN {
|
||||
$VERSION = '1.42';
|
||||
}
|
||||
|
||||
use Config;
|
||||
|
||||
# enable debug/trace messages from DynaLoader perl code
|
||||
$dl_debug = $ENV{PERL_DL_DEBUG} || 0 unless defined $dl_debug;
|
||||
|
||||
#
|
||||
# Flags to alter dl_load_file behaviour. Assigned bits:
|
||||
# 0x01 make symbols available for linking later dl_load_file's.
|
||||
# (only known to work on Solaris 2 using dlopen(RTLD_GLOBAL))
|
||||
# (ignored under VMS; effect is built-in to image linking)
|
||||
# (ignored under Android; the linker always uses RTLD_LOCAL)
|
||||
#
|
||||
# This is called as a class method $module->dl_load_flags. The
|
||||
# definition here will be inherited and result on "default" loading
|
||||
# behaviour unless a sub-class of DynaLoader defines its own version.
|
||||
#
|
||||
|
||||
sub dl_load_flags { 0x00 }
|
||||
|
||||
($dl_dlext, $dl_so, $dlsrc) = @Config::Config{qw(dlext so dlsrc)};
|
||||
|
||||
$do_expand = 0;
|
||||
|
||||
@dl_require_symbols = (); # names of symbols we need
|
||||
@dl_library_path = (); # path to look for files
|
||||
|
||||
#XSLoader.pm may have added elements before we were required
|
||||
#@dl_shared_objects = (); # shared objects for symbols we have
|
||||
#@dl_librefs = (); # things we have loaded
|
||||
#@dl_modules = (); # Modules we have loaded
|
||||
|
||||
# Initialise @dl_library_path with the 'standard' library path
|
||||
# for this platform as determined by Configure.
|
||||
|
||||
push(@dl_library_path, split(' ', $Config::Config{libpth}));
|
||||
|
||||
my $ldlibpthname = $Config::Config{ldlibpthname};
|
||||
my $ldlibpthname_defined = defined $Config::Config{ldlibpthname};
|
||||
my $pthsep = $Config::Config{path_sep};
|
||||
|
||||
# Add to @dl_library_path any extra directories we can gather from environment
|
||||
# during runtime.
|
||||
|
||||
if ($ldlibpthname_defined &&
|
||||
exists $ENV{$ldlibpthname}) {
|
||||
push(@dl_library_path, split(/$pthsep/, $ENV{$ldlibpthname}));
|
||||
}
|
||||
|
||||
# E.g. HP-UX supports both its native SHLIB_PATH *and* LD_LIBRARY_PATH.
|
||||
|
||||
if ($ldlibpthname_defined &&
|
||||
$ldlibpthname ne 'LD_LIBRARY_PATH' &&
|
||||
exists $ENV{LD_LIBRARY_PATH}) {
|
||||
push(@dl_library_path, split(/$pthsep/, $ENV{LD_LIBRARY_PATH}));
|
||||
}
|
||||
|
||||
# No prizes for guessing why we don't say 'bootstrap DynaLoader;' here.
|
||||
# NOTE: All dl_*.xs (including dl_none.xs) define a dl_error() XSUB
|
||||
boot_DynaLoader('DynaLoader') if defined(&boot_DynaLoader) &&
|
||||
!defined(&dl_error);
|
||||
|
||||
if ($dl_debug) {
|
||||
print STDERR "DynaLoader.pm loaded (@INC, @dl_library_path)\n";
|
||||
print STDERR "DynaLoader not linked into this perl\n"
|
||||
unless defined(&boot_DynaLoader);
|
||||
}
|
||||
|
||||
1; # End of main code
|
||||
|
||||
sub croak { require Carp; Carp::croak(@_) }
|
||||
|
||||
sub bootstrap_inherit {
|
||||
my $module = $_[0];
|
||||
local *isa = *{"$module\::ISA"};
|
||||
local @isa = (@isa, 'DynaLoader');
|
||||
# Cannot goto due to delocalization. Will report errors on a wrong line?
|
||||
bootstrap(@_);
|
||||
}
|
||||
|
||||
sub bootstrap {
|
||||
# use local vars to enable $module.bs script to edit values
|
||||
local(@args) = @_;
|
||||
local($module) = $args[0];
|
||||
local(@dirs, $file);
|
||||
|
||||
unless ($module) {
|
||||
require Carp;
|
||||
Carp::confess("Usage: DynaLoader::bootstrap(module)");
|
||||
}
|
||||
|
||||
# A common error on platforms which don't support dynamic loading.
|
||||
# Since it's fatal and potentially confusing we give a detailed message.
|
||||
croak("Can't load module $module, dynamic loading not available in this perl.\n".
|
||||
" (You may need to build a new perl executable which either supports\n".
|
||||
" dynamic loading or has the $module module statically linked into it.)\n")
|
||||
unless defined(&dl_load_file);
|
||||
|
||||
|
||||
my @modparts = split(/::/,$module);
|
||||
my $modfname = $modparts[-1];
|
||||
my $modfname_orig = $modfname; # For .bs file search
|
||||
|
||||
# Some systems have restrictions on files names for DLL's etc.
|
||||
# mod2fname returns appropriate file base name (typically truncated)
|
||||
# It may also edit @modparts if required.
|
||||
$modfname = &mod2fname(\@modparts) if defined &mod2fname;
|
||||
|
||||
|
||||
|
||||
my $modpname = join('/',@modparts);
|
||||
|
||||
print STDERR "DynaLoader::bootstrap for $module ",
|
||||
"(auto/$modpname/$modfname.$dl_dlext)\n"
|
||||
if $dl_debug;
|
||||
|
||||
my $dir;
|
||||
foreach (@INC) {
|
||||
|
||||
$dir = "$_/auto/$modpname";
|
||||
|
||||
next unless -d $dir; # skip over uninteresting directories
|
||||
|
||||
# check for common cases to avoid autoload of dl_findfile
|
||||
my $try = "$dir/$modfname.$dl_dlext";
|
||||
last if $file = ($do_expand) ? dl_expandspec($try) : ((-f $try) && $try);
|
||||
|
||||
# no luck here, save dir for possible later dl_findfile search
|
||||
push @dirs, $dir;
|
||||
}
|
||||
# last resort, let dl_findfile have a go in all known locations
|
||||
$file = dl_findfile(map("-L$_",@dirs,@INC), $modfname) unless $file;
|
||||
|
||||
croak("Can't locate loadable object for module $module in \@INC (\@INC contains: @INC)")
|
||||
unless $file; # wording similar to error from 'require'
|
||||
|
||||
|
||||
my $bootname = "boot_$module";
|
||||
$bootname =~ s/\W/_/g;
|
||||
@dl_require_symbols = ($bootname);
|
||||
|
||||
# Execute optional '.bootstrap' perl script for this module.
|
||||
# The .bs file can be used to configure @dl_resolve_using etc to
|
||||
# match the needs of the individual module on this architecture.
|
||||
# N.B. The .bs file does not following the naming convention used
|
||||
# by mod2fname.
|
||||
my $bs = "$dir/$modfname_orig";
|
||||
$bs =~ s/(\.\w+)?(;\d*)?$/\.bs/; # look for .bs 'beside' the library
|
||||
if (-s $bs) { # only read file if it's not empty
|
||||
print STDERR "BS: $bs ($^O, $dlsrc)\n" if $dl_debug;
|
||||
eval { local @INC = ('.'); do $bs; };
|
||||
warn "$bs: $@\n" if $@;
|
||||
}
|
||||
|
||||
my $boot_symbol_ref;
|
||||
|
||||
|
||||
|
||||
# Many dynamic extension loading problems will appear to come from
|
||||
# this section of code: XYZ failed at line 123 of DynaLoader.pm.
|
||||
# Often these errors are actually occurring in the initialisation
|
||||
# C code of the extension XS file. Perl reports the error as being
|
||||
# in this perl code simply because this was the last perl code
|
||||
# it executed.
|
||||
|
||||
my $flags = $module->dl_load_flags;
|
||||
|
||||
my $libref = dl_load_file($file, $flags) or
|
||||
croak("Can't load '$file' for module $module: ".dl_error());
|
||||
|
||||
push(@dl_librefs,$libref); # record loaded object
|
||||
|
||||
$boot_symbol_ref = dl_find_symbol($libref, $bootname) or
|
||||
croak("Can't find '$bootname' symbol in $file\n");
|
||||
|
||||
push(@dl_modules, $module); # record loaded module
|
||||
|
||||
boot:
|
||||
my $xs = dl_install_xsub("${module}::bootstrap", $boot_symbol_ref, $file);
|
||||
|
||||
# See comment block above
|
||||
|
||||
push(@dl_shared_objects, $file); # record files loaded
|
||||
|
||||
&$xs(@args);
|
||||
}
|
||||
|
||||
sub dl_findfile {
|
||||
# This function does not automatically consider the architecture
|
||||
# or the perl library auto directories.
|
||||
my (@args) = @_;
|
||||
my (@dirs, $dir); # which directories to search
|
||||
my (@found); # full paths to real files we have found
|
||||
#my $dl_ext= 'so'; # $Config::Config{'dlext'} suffix for perl extensions
|
||||
#my $dl_so = 'so'; # $Config::Config{'so'} suffix for shared libraries
|
||||
|
||||
print STDERR "dl_findfile(@args)\n" if $dl_debug;
|
||||
|
||||
# accumulate directories but process files as they appear
|
||||
arg: foreach(@args) {
|
||||
# Special fast case: full filepath requires no search
|
||||
|
||||
|
||||
if (m:/: && -f $_) {
|
||||
push(@found,$_);
|
||||
last arg unless wantarray;
|
||||
next;
|
||||
}
|
||||
|
||||
|
||||
# Deal with directories first:
|
||||
# Using a -L prefix is the preferred option (faster and more robust)
|
||||
if (m:^-L:) { s/^-L//; push(@dirs, $_); next; }
|
||||
|
||||
# Otherwise we try to try to spot directories by a heuristic
|
||||
# (this is a more complicated issue than it first appears)
|
||||
if (m:/: && -d $_) { push(@dirs, $_); next; }
|
||||
|
||||
|
||||
|
||||
# Only files should get this far...
|
||||
my(@names, $name); # what filenames to look for
|
||||
if (m:-l: ) { # convert -lname to appropriate library name
|
||||
s/-l//;
|
||||
push(@names,"lib$_.$dl_so");
|
||||
push(@names,"lib$_.a");
|
||||
} else { # Umm, a bare name. Try various alternatives:
|
||||
# these should be ordered with the most likely first
|
||||
push(@names,"$_.$dl_dlext") unless m/\.$dl_dlext$/o;
|
||||
push(@names,"$_.$dl_so") unless m/\.$dl_so$/o;
|
||||
|
||||
push(@names,"lib$_.$dl_so") unless m:/:;
|
||||
push(@names, $_);
|
||||
}
|
||||
my $dirsep = '/';
|
||||
|
||||
foreach $dir (@dirs, @dl_library_path) {
|
||||
next unless -d $dir;
|
||||
|
||||
foreach $name (@names) {
|
||||
my($file) = "$dir$dirsep$name";
|
||||
print STDERR " checking in $dir for $name\n" if $dl_debug;
|
||||
$file = ($do_expand) ? dl_expandspec($file) : (-f $file && $file);
|
||||
#$file = _check_file($file);
|
||||
if ($file) {
|
||||
push(@found, $file);
|
||||
next arg; # no need to look any further
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($dl_debug) {
|
||||
foreach(@dirs) {
|
||||
print STDERR " dl_findfile ignored non-existent directory: $_\n" unless -d $_;
|
||||
}
|
||||
print STDERR "dl_findfile found: @found\n";
|
||||
}
|
||||
return $found[0] unless wantarray;
|
||||
@found;
|
||||
}
|
||||
|
||||
sub dl_expandspec {
|
||||
my($spec) = @_;
|
||||
# Optional function invoked if DynaLoader.pm sets $do_expand.
|
||||
# Most systems do not require or use this function.
|
||||
# Some systems may implement it in the dl_*.xs file in which case
|
||||
# this Perl version should be excluded at build time.
|
||||
|
||||
# This function is designed to deal with systems which treat some
|
||||
# 'filenames' in a special way. For example VMS 'Logical Names'
|
||||
# (something like unix environment variables - but different).
|
||||
# This function should recognise such names and expand them into
|
||||
# full file paths.
|
||||
# Must return undef if $spec is invalid or file does not exist.
|
||||
|
||||
my $file = $spec; # default output to input
|
||||
|
||||
return undef unless -f $file;
|
||||
print STDERR "dl_expandspec($spec) => $file\n" if $dl_debug;
|
||||
$file;
|
||||
}
|
||||
|
||||
sub dl_find_symbol_anywhere
|
||||
{
|
||||
my $sym = shift;
|
||||
my $libref;
|
||||
foreach $libref (@dl_librefs) {
|
||||
my $symref = dl_find_symbol($libref,$sym,1);
|
||||
return $symref if $symref;
|
||||
}
|
||||
return undef;
|
||||
}
|
||||
|
||||
__END__
|
||||
|
|
@ -0,0 +1,229 @@
|
|||
# -*- buffer-read-only: t -*-
|
||||
#
|
||||
# This file is auto-generated by ext/Errno/Errno_pm.PL.
|
||||
# ***ANY*** changes here will be lost.
|
||||
#
|
||||
|
||||
package Errno;
|
||||
require Exporter;
|
||||
use strict;
|
||||
|
||||
our $VERSION = "1.28";
|
||||
$VERSION = eval $VERSION;
|
||||
our @ISA = 'Exporter';
|
||||
|
||||
my %err;
|
||||
|
||||
BEGIN {
|
||||
%err = (
|
||||
EPERM => 1,
|
||||
ENOENT => 2,
|
||||
ESRCH => 3,
|
||||
EINTR => 4,
|
||||
EIO => 5,
|
||||
ENXIO => 6,
|
||||
E2BIG => 7,
|
||||
ENOEXEC => 8,
|
||||
EBADF => 9,
|
||||
ECHILD => 10,
|
||||
EAGAIN => 11,
|
||||
EWOULDBLOCK => 11,
|
||||
ENOMEM => 12,
|
||||
EACCES => 13,
|
||||
EFAULT => 14,
|
||||
ENOTBLK => 15,
|
||||
EBUSY => 16,
|
||||
EEXIST => 17,
|
||||
EXDEV => 18,
|
||||
ENODEV => 19,
|
||||
ENOTDIR => 20,
|
||||
EISDIR => 21,
|
||||
EINVAL => 22,
|
||||
ENFILE => 23,
|
||||
EMFILE => 24,
|
||||
ENOTTY => 25,
|
||||
ETXTBSY => 26,
|
||||
EFBIG => 27,
|
||||
ENOSPC => 28,
|
||||
ESPIPE => 29,
|
||||
EROFS => 30,
|
||||
EMLINK => 31,
|
||||
EPIPE => 32,
|
||||
EDOM => 33,
|
||||
ERANGE => 34,
|
||||
EDEADLK => 35,
|
||||
EDEADLOCK => 35,
|
||||
ENAMETOOLONG => 36,
|
||||
ENOLCK => 37,
|
||||
ENOSYS => 38,
|
||||
ENOTEMPTY => 39,
|
||||
ELOOP => 40,
|
||||
ENOMSG => 42,
|
||||
EIDRM => 43,
|
||||
ECHRNG => 44,
|
||||
EL2NSYNC => 45,
|
||||
EL3HLT => 46,
|
||||
EL3RST => 47,
|
||||
ELNRNG => 48,
|
||||
EUNATCH => 49,
|
||||
ENOCSI => 50,
|
||||
EL2HLT => 51,
|
||||
EBADE => 52,
|
||||
EBADR => 53,
|
||||
EXFULL => 54,
|
||||
ENOANO => 55,
|
||||
EBADRQC => 56,
|
||||
EBADSLT => 57,
|
||||
EBFONT => 59,
|
||||
ENOSTR => 60,
|
||||
ENODATA => 61,
|
||||
ETIME => 62,
|
||||
ENOSR => 63,
|
||||
ENONET => 64,
|
||||
ENOPKG => 65,
|
||||
EREMOTE => 66,
|
||||
ENOLINK => 67,
|
||||
EADV => 68,
|
||||
ESRMNT => 69,
|
||||
ECOMM => 70,
|
||||
EPROTO => 71,
|
||||
EMULTIHOP => 72,
|
||||
EDOTDOT => 73,
|
||||
EBADMSG => 74,
|
||||
EOVERFLOW => 75,
|
||||
ENOTUNIQ => 76,
|
||||
EBADFD => 77,
|
||||
EREMCHG => 78,
|
||||
ELIBACC => 79,
|
||||
ELIBBAD => 80,
|
||||
ELIBSCN => 81,
|
||||
ELIBMAX => 82,
|
||||
ELIBEXEC => 83,
|
||||
EILSEQ => 84,
|
||||
ERESTART => 85,
|
||||
ESTRPIPE => 86,
|
||||
EUSERS => 87,
|
||||
ENOTSOCK => 88,
|
||||
EDESTADDRREQ => 89,
|
||||
EMSGSIZE => 90,
|
||||
EPROTOTYPE => 91,
|
||||
ENOPROTOOPT => 92,
|
||||
EPROTONOSUPPORT => 93,
|
||||
ESOCKTNOSUPPORT => 94,
|
||||
ENOTSUP => 95,
|
||||
EOPNOTSUPP => 95,
|
||||
EPFNOSUPPORT => 96,
|
||||
EAFNOSUPPORT => 97,
|
||||
EADDRINUSE => 98,
|
||||
EADDRNOTAVAIL => 99,
|
||||
ENETDOWN => 100,
|
||||
ENETUNREACH => 101,
|
||||
ENETRESET => 102,
|
||||
ECONNABORTED => 103,
|
||||
ECONNRESET => 104,
|
||||
ENOBUFS => 105,
|
||||
EISCONN => 106,
|
||||
ENOTCONN => 107,
|
||||
ESHUTDOWN => 108,
|
||||
ETOOMANYREFS => 109,
|
||||
ETIMEDOUT => 110,
|
||||
ECONNREFUSED => 111,
|
||||
EHOSTDOWN => 112,
|
||||
EHOSTUNREACH => 113,
|
||||
EALREADY => 114,
|
||||
EINPROGRESS => 115,
|
||||
ESTALE => 116,
|
||||
EUCLEAN => 117,
|
||||
ENOTNAM => 118,
|
||||
ENAVAIL => 119,
|
||||
EISNAM => 120,
|
||||
EREMOTEIO => 121,
|
||||
EDQUOT => 122,
|
||||
ENOMEDIUM => 123,
|
||||
EMEDIUMTYPE => 124,
|
||||
ECANCELED => 125,
|
||||
ENOKEY => 126,
|
||||
EKEYEXPIRED => 127,
|
||||
EKEYREVOKED => 128,
|
||||
EKEYREJECTED => 129,
|
||||
EOWNERDEAD => 130,
|
||||
ENOTRECOVERABLE => 131,
|
||||
ERFKILL => 132,
|
||||
EHWPOISON => 133,
|
||||
);
|
||||
# Generate proxy constant subroutines for all the values.
|
||||
# Well, almost all the values. Unfortunately we can't assume that at this
|
||||
# point that our symbol table is empty, as code such as if the parser has
|
||||
# seen code such as C<exists &Errno::EINVAL>, it will have created the
|
||||
# typeglob.
|
||||
# Doing this before defining @EXPORT_OK etc means that even if a platform is
|
||||
# crazy enough to define EXPORT_OK as an error constant, everything will
|
||||
# still work, because the parser will upgrade the PCS to a real typeglob.
|
||||
# We rely on the subroutine definitions below to update the internal caches.
|
||||
# Don't use %each, as we don't want a copy of the value.
|
||||
foreach my $name (keys %err) {
|
||||
if ($Errno::{$name}) {
|
||||
# We expect this to be reached fairly rarely, so take an approach
|
||||
# which uses the least compile time effort in the common case:
|
||||
eval "sub $name() { $err{$name} }; 1" or die $@;
|
||||
} else {
|
||||
$Errno::{$name} = \$err{$name};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
our @EXPORT_OK = keys %err;
|
||||
|
||||
our %EXPORT_TAGS = (
|
||||
POSIX => [qw(
|
||||
E2BIG EACCES EADDRINUSE EADDRNOTAVAIL EAFNOSUPPORT EAGAIN EALREADY
|
||||
EBADF EBUSY ECHILD ECONNABORTED ECONNREFUSED ECONNRESET EDEADLK
|
||||
EDESTADDRREQ EDOM EDQUOT EEXIST EFAULT EFBIG EHOSTDOWN EHOSTUNREACH
|
||||
EINPROGRESS EINTR EINVAL EIO EISCONN EISDIR ELOOP EMFILE EMLINK
|
||||
EMSGSIZE ENAMETOOLONG ENETDOWN ENETRESET ENETUNREACH ENFILE ENOBUFS
|
||||
ENODEV ENOENT ENOEXEC ENOLCK ENOMEM ENOPROTOOPT ENOSPC ENOSYS ENOTBLK
|
||||
ENOTCONN ENOTDIR ENOTEMPTY ENOTSOCK ENOTTY ENXIO EOPNOTSUPP EPERM
|
||||
EPFNOSUPPORT EPIPE EPROTONOSUPPORT EPROTOTYPE ERANGE EREMOTE ERESTART
|
||||
EROFS ESHUTDOWN ESOCKTNOSUPPORT ESPIPE ESRCH ESTALE ETIMEDOUT
|
||||
ETOOMANYREFS ETXTBSY EUSERS EWOULDBLOCK EXDEV
|
||||
)],
|
||||
);
|
||||
|
||||
sub TIEHASH { bless \%err }
|
||||
|
||||
sub FETCH {
|
||||
my (undef, $errname) = @_;
|
||||
return "" unless exists $err{$errname};
|
||||
my $errno = $err{$errname};
|
||||
return $errno == $! ? $errno : 0;
|
||||
}
|
||||
|
||||
sub STORE {
|
||||
require Carp;
|
||||
Carp::confess("ERRNO hash is read only!");
|
||||
}
|
||||
|
||||
# This is the true return value
|
||||
*CLEAR = *DELETE = \*STORE; # Typeglob aliasing uses less space
|
||||
|
||||
sub NEXTKEY {
|
||||
each %err;
|
||||
}
|
||||
|
||||
sub FIRSTKEY {
|
||||
my $s = scalar keys %err; # initialize iterator
|
||||
each %err;
|
||||
}
|
||||
|
||||
sub EXISTS {
|
||||
my (undef, $errname) = @_;
|
||||
exists $err{$errname};
|
||||
}
|
||||
|
||||
sub _tie_it {
|
||||
tie %{$_[0]}, __PACKAGE__;
|
||||
}
|
||||
|
||||
__END__
|
||||
|
||||
# ex: set ro:
|
|
@ -0,0 +1,98 @@
|
|||
package Exporter;
|
||||
|
||||
require 5.006;
|
||||
|
||||
# Be lean.
|
||||
#use strict;
|
||||
#no strict 'refs';
|
||||
|
||||
our $Debug = 0;
|
||||
our $ExportLevel = 0;
|
||||
our $Verbose ||= 0;
|
||||
our $VERSION = '5.72';
|
||||
our (%Cache);
|
||||
|
||||
sub as_heavy {
|
||||
require Exporter::Heavy;
|
||||
# Unfortunately, this does not work if the caller is aliased as *name = \&foo
|
||||
# Thus the need to create a lot of identical subroutines
|
||||
my $c = (caller(1))[3];
|
||||
$c =~ s/.*:://;
|
||||
\&{"Exporter::Heavy::heavy_$c"};
|
||||
}
|
||||
|
||||
sub export {
|
||||
goto &{as_heavy()};
|
||||
}
|
||||
|
||||
sub import {
|
||||
my $pkg = shift;
|
||||
my $callpkg = caller($ExportLevel);
|
||||
|
||||
if ($pkg eq "Exporter" and @_ and $_[0] eq "import") {
|
||||
*{$callpkg."::import"} = \&import;
|
||||
return;
|
||||
}
|
||||
|
||||
# We *need* to treat @{"$pkg\::EXPORT_FAIL"} since Carp uses it :-(
|
||||
my $exports = \@{"$pkg\::EXPORT"};
|
||||
# But, avoid creating things if they don't exist, which saves a couple of
|
||||
# hundred bytes per package processed.
|
||||
my $fail = ${$pkg . '::'}{EXPORT_FAIL} && \@{"$pkg\::EXPORT_FAIL"};
|
||||
return export $pkg, $callpkg, @_
|
||||
if $Verbose or $Debug or $fail && @$fail > 1;
|
||||
my $export_cache = ($Cache{$pkg} ||= {});
|
||||
my $args = @_ or @_ = @$exports;
|
||||
|
||||
if ($args and not %$export_cache) {
|
||||
s/^&//, $export_cache->{$_} = 1
|
||||
foreach (@$exports, @{"$pkg\::EXPORT_OK"});
|
||||
}
|
||||
my $heavy;
|
||||
# Try very hard not to use {} and hence have to enter scope on the foreach
|
||||
# We bomb out of the loop with last as soon as heavy is set.
|
||||
if ($args or $fail) {
|
||||
($heavy = (/\W/ or $args and not exists $export_cache->{$_}
|
||||
or $fail and @$fail and $_ eq $fail->[0])) and last
|
||||
foreach (@_);
|
||||
} else {
|
||||
($heavy = /\W/) and last
|
||||
foreach (@_);
|
||||
}
|
||||
return export $pkg, $callpkg, ($args ? @_ : ()) if $heavy;
|
||||
local $SIG{__WARN__} =
|
||||
sub {require Carp; &Carp::carp} if not $SIG{__WARN__};
|
||||
# shortcut for the common case of no type character
|
||||
*{"$callpkg\::$_"} = \&{"$pkg\::$_"} foreach @_;
|
||||
}
|
||||
|
||||
# Default methods
|
||||
|
||||
sub export_fail {
|
||||
my $self = shift;
|
||||
@_;
|
||||
}
|
||||
|
||||
# Unfortunately, caller(1)[3] "does not work" if the caller is aliased as
|
||||
# *name = \&foo. Thus the need to create a lot of identical subroutines
|
||||
# Otherwise we could have aliased them to export().
|
||||
|
||||
sub export_to_level {
|
||||
goto &{as_heavy()};
|
||||
}
|
||||
|
||||
sub export_tags {
|
||||
goto &{as_heavy()};
|
||||
}
|
||||
|
||||
sub export_ok_tags {
|
||||
goto &{as_heavy()};
|
||||
}
|
||||
|
||||
sub require_version {
|
||||
goto &{as_heavy()};
|
||||
}
|
||||
|
||||
1;
|
||||
__END__
|
||||
|
|
@ -0,0 +1,239 @@
|
|||
package Exporter::Heavy;
|
||||
|
||||
use strict;
|
||||
no strict 'refs';
|
||||
|
||||
# On one line so MakeMaker will see it.
|
||||
require Exporter; our $VERSION = $Exporter::VERSION;
|
||||
|
||||
#
|
||||
# We go to a lot of trouble not to 'require Carp' at file scope,
|
||||
# because Carp requires Exporter, and something has to give.
|
||||
#
|
||||
|
||||
sub _rebuild_cache {
|
||||
my ($pkg, $exports, $cache) = @_;
|
||||
s/^&// foreach @$exports;
|
||||
@{$cache}{@$exports} = (1) x @$exports;
|
||||
my $ok = \@{"${pkg}::EXPORT_OK"};
|
||||
if (@$ok) {
|
||||
s/^&// foreach @$ok;
|
||||
@{$cache}{@$ok} = (1) x @$ok;
|
||||
}
|
||||
}
|
||||
|
||||
sub heavy_export {
|
||||
|
||||
# Save the old __WARN__ handler in case it was defined
|
||||
my $oldwarn = $SIG{__WARN__};
|
||||
|
||||
# First make import warnings look like they're coming from the "use".
|
||||
local $SIG{__WARN__} = sub {
|
||||
# restore it back so proper stacking occurs
|
||||
local $SIG{__WARN__} = $oldwarn;
|
||||
my $text = shift;
|
||||
if ($text =~ s/ at \S*Exporter\S*.pm line \d+.*\n//) {
|
||||
require Carp;
|
||||
local $Carp::CarpLevel = 1; # ignore package calling us too.
|
||||
Carp::carp($text);
|
||||
}
|
||||
else {
|
||||
warn $text;
|
||||
}
|
||||
};
|
||||
local $SIG{__DIE__} = sub {
|
||||
require Carp;
|
||||
local $Carp::CarpLevel = 1; # ignore package calling us too.
|
||||
Carp::croak("$_[0]Illegal null symbol in \@${1}::EXPORT")
|
||||
if $_[0] =~ /^Unable to create sub named "(.*?)::"/;
|
||||
};
|
||||
|
||||
my($pkg, $callpkg, @imports) = @_;
|
||||
my($type, $sym, $cache_is_current, $oops);
|
||||
my($exports, $export_cache) = (\@{"${pkg}::EXPORT"},
|
||||
$Exporter::Cache{$pkg} ||= {});
|
||||
|
||||
if (@imports) {
|
||||
if (!%$export_cache) {
|
||||
_rebuild_cache ($pkg, $exports, $export_cache);
|
||||
$cache_is_current = 1;
|
||||
}
|
||||
|
||||
if (grep m{^[/!:]}, @imports) {
|
||||
my $tagsref = \%{"${pkg}::EXPORT_TAGS"};
|
||||
my $tagdata;
|
||||
my %imports;
|
||||
my($remove, $spec, @names, @allexports);
|
||||
# negated first item implies starting with default set:
|
||||
unshift @imports, ':DEFAULT' if $imports[0] =~ m/^!/;
|
||||
foreach $spec (@imports){
|
||||
$remove = $spec =~ s/^!//;
|
||||
|
||||
if ($spec =~ s/^://){
|
||||
if ($spec eq 'DEFAULT'){
|
||||
@names = @$exports;
|
||||
}
|
||||
elsif ($tagdata = $tagsref->{$spec}) {
|
||||
@names = @$tagdata;
|
||||
}
|
||||
else {
|
||||
warn qq["$spec" is not defined in %${pkg}::EXPORT_TAGS];
|
||||
++$oops;
|
||||
next;
|
||||
}
|
||||
}
|
||||
elsif ($spec =~ m:^/(.*)/$:){
|
||||
my $patn = $1;
|
||||
@allexports = keys %$export_cache unless @allexports; # only do keys once
|
||||
@names = grep(/$patn/, @allexports); # not anchored by default
|
||||
}
|
||||
else {
|
||||
@names = ($spec); # is a normal symbol name
|
||||
}
|
||||
|
||||
warn "Import ".($remove ? "del":"add").": @names "
|
||||
if $Exporter::Verbose;
|
||||
|
||||
if ($remove) {
|
||||
foreach $sym (@names) { delete $imports{$sym} }
|
||||
}
|
||||
else {
|
||||
@imports{@names} = (1) x @names;
|
||||
}
|
||||
}
|
||||
@imports = keys %imports;
|
||||
}
|
||||
|
||||
my @carp;
|
||||
foreach $sym (@imports) {
|
||||
if (!$export_cache->{$sym}) {
|
||||
if ($sym =~ m/^\d/) {
|
||||
$pkg->VERSION($sym); # inherit from UNIVERSAL
|
||||
# If the version number was the only thing specified
|
||||
# then we should act as if nothing was specified:
|
||||
if (@imports == 1) {
|
||||
@imports = @$exports;
|
||||
last;
|
||||
}
|
||||
# We need a way to emulate 'use Foo ()' but still
|
||||
# allow an easy version check: "use Foo 1.23, ''";
|
||||
if (@imports == 2 and !$imports[1]) {
|
||||
@imports = ();
|
||||
last;
|
||||
}
|
||||
} elsif ($sym !~ s/^&// || !$export_cache->{$sym}) {
|
||||
# Last chance - see if they've updated EXPORT_OK since we
|
||||
# cached it.
|
||||
|
||||
unless ($cache_is_current) {
|
||||
%$export_cache = ();
|
||||
_rebuild_cache ($pkg, $exports, $export_cache);
|
||||
$cache_is_current = 1;
|
||||
}
|
||||
|
||||
if (!$export_cache->{$sym}) {
|
||||
# accumulate the non-exports
|
||||
push @carp,
|
||||
qq["$sym" is not exported by the $pkg module\n];
|
||||
$oops++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($oops) {
|
||||
require Carp;
|
||||
Carp::croak("@{carp}Can't continue after import errors");
|
||||
}
|
||||
}
|
||||
else {
|
||||
@imports = @$exports;
|
||||
}
|
||||
|
||||
my($fail, $fail_cache) = (\@{"${pkg}::EXPORT_FAIL"},
|
||||
$Exporter::FailCache{$pkg} ||= {});
|
||||
|
||||
if (@$fail) {
|
||||
if (!%$fail_cache) {
|
||||
# Build cache of symbols. Optimise the lookup by adding
|
||||
# barewords twice... both with and without a leading &.
|
||||
# (Technique could be applied to $export_cache at cost of memory)
|
||||
my @expanded = map { /^\w/ ? ($_, '&'.$_) : $_ } @$fail;
|
||||
warn "${pkg}::EXPORT_FAIL cached: @expanded" if $Exporter::Verbose;
|
||||
@{$fail_cache}{@expanded} = (1) x @expanded;
|
||||
}
|
||||
my @failed;
|
||||
foreach $sym (@imports) { push(@failed, $sym) if $fail_cache->{$sym} }
|
||||
if (@failed) {
|
||||
@failed = $pkg->export_fail(@failed);
|
||||
foreach $sym (@failed) {
|
||||
require Carp;
|
||||
Carp::carp(qq["$sym" is not implemented by the $pkg module ],
|
||||
"on this architecture");
|
||||
}
|
||||
if (@failed) {
|
||||
require Carp;
|
||||
Carp::croak("Can't continue after import errors");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
warn "Importing into $callpkg from $pkg: ",
|
||||
join(", ",sort @imports) if $Exporter::Verbose;
|
||||
|
||||
foreach $sym (@imports) {
|
||||
# shortcut for the common case of no type character
|
||||
(*{"${callpkg}::$sym"} = \&{"${pkg}::$sym"}, next)
|
||||
unless $sym =~ s/^(\W)//;
|
||||
$type = $1;
|
||||
no warnings 'once';
|
||||
*{"${callpkg}::$sym"} =
|
||||
$type eq '&' ? \&{"${pkg}::$sym"} :
|
||||
$type eq '$' ? \${"${pkg}::$sym"} :
|
||||
$type eq '@' ? \@{"${pkg}::$sym"} :
|
||||
$type eq '%' ? \%{"${pkg}::$sym"} :
|
||||
$type eq '*' ? *{"${pkg}::$sym"} :
|
||||
do { require Carp; Carp::croak("Can't export symbol: $type$sym") };
|
||||
}
|
||||
}
|
||||
|
||||
sub heavy_export_to_level
|
||||
{
|
||||
my $pkg = shift;
|
||||
my $level = shift;
|
||||
(undef) = shift; # XXX redundant arg
|
||||
my $callpkg = caller($level);
|
||||
$pkg->export($callpkg, @_);
|
||||
}
|
||||
|
||||
# Utility functions
|
||||
|
||||
sub _push_tags {
|
||||
my($pkg, $var, $syms) = @_;
|
||||
my @nontag = ();
|
||||
my $export_tags = \%{"${pkg}::EXPORT_TAGS"};
|
||||
push(@{"${pkg}::$var"},
|
||||
map { $export_tags->{$_} ? @{$export_tags->{$_}}
|
||||
: scalar(push(@nontag,$_),$_) }
|
||||
(@$syms) ? @$syms : keys %$export_tags);
|
||||
if (@nontag and $^W) {
|
||||
# This may change to a die one day
|
||||
require Carp;
|
||||
Carp::carp(join(", ", @nontag)." are not tags of $pkg");
|
||||
}
|
||||
}
|
||||
|
||||
sub heavy_require_version {
|
||||
my($self, $wanted) = @_;
|
||||
my $pkg = ref $self || $self;
|
||||
return ${pkg}->VERSION($wanted);
|
||||
}
|
||||
|
||||
sub heavy_export_tags {
|
||||
_push_tags((caller)[0], "EXPORT", \@_);
|
||||
}
|
||||
|
||||
sub heavy_export_ok_tags {
|
||||
_push_tags((caller)[0], "EXPORT_OK", \@_);
|
||||
}
|
||||
|
||||
1;
|