Android Nougat wpa_supplicant.conf id_str - android

I have upgraded my Nexus 5 to Nougat (7.1.2) and had to wipe it.
I tried to restore my WLAN networks by copying the old wpa_supplicant.conf, which crashed the whole wlan module. By comparing the old to the fresh file I noticed that on the new one the networks contain a new field id_str:
Old:
network={
ssid="WLAN2"
key_mgmt=NONE
priority=1
}
New:
network={
ssid="WLAN2"
key_mgmt=NONE
priority=1
id_str="%7B%22creatorUid%22%3A%221000%22%2C%22configKey%22%3A%22%5C%22WLAN2%5C%22NONE%22%7D"
}
Is there any way to generate the id_str, such that dont have to reconfigure all the networks?

Related

Flutter app assets - unable to load files with names with non-latin characters

I have a quiz app with:
Video assets (over 1000 files, 750 MB) that can be downloaded using the download_assets package.
Image assets (also over 1000 files, 80 MB), bundled and deployed with the app.
Filenames are stored in a sqlite database.
I'm using Android Studio, macOS.
I wrote a function that takes filenames from a database and checks which files are on a device.
As it turned out, several of the video files are unavailable on Android devices (although they are visible in Device File Explorer). On iOS devices everything is OK.
Also some images are not available, but here on both iOS and Android devices.
I wrote Python script:
import os
import chardet
dir = '/path/to/directory/with/assets'
for n in os.listdir(dir):
if (chardet.detect(os.fsencode(n))['encoding'] != 'ascii'):
print ('{} => {} (confidence: {})'.format(n, chardet.detect(os.fsencode(n))['encoding'], chardet.detect(os.fsencode(n))['confidence']))
All files that work are encoded in ascii, the rest looks like this:
pięć5.mp4 => utf-8 (confidence: 0.7525)
JAZDA NOCĄorg.mp4 => ISO-8859-1 (confidence: 0.73)
Rowerzystę W17_2.mp4 => utf-8 (confidence: 0.505)
I tried renaming files in terminal. Then I tried to use the convmv utility. When I prepared a zip in terminal with only these 3 files it worked, but when I created a full archive, it turned out that two other files that worked fine before (and which had non-Latin characters in the name) stopped loading.
My final solution: I packed the two problem files in Finder (like the first archive). Then I added the rest of the files to the archive in the terminal:
zip assets.zip *.mp4
Now all video files load on both Android and iOS devices. But why?
I also solved the problem with the image files. I tried with mv and conmv in the terminal of course. I think it worked with at least one file (I'm not sure because I was in the dark and don't know what finally worked). I got stuck with a few files and that's when I found this link.
I used the Refactor->Rename option in Android Studio. I renamed the files to those that did not contain non-Latin characters (e.g. 313D12_a_org_światło.jpg to 313D12_a_org_swiatlo.jpg). I restarted the application. Then I renamed the files in Android Studio to the old ones. After restart all the files worked.
I am writing all this for two reasons:
Maybe someone will have similar problems and this description will be useful to him.
I am very curious what is causing this behavior. Especially, why files extracted from a zip will behave differently depending on how the zip is prepared and on which device it is used (Android or iOS).

Linux P2P (wifi-direct) configuration is not visible only in Android 13

We have a Linux device that configures a p2p network (wifi-direct). Everything works fine on Android versions lower than 13 but when scanning wifi-direct devices on an Android 13, it does not appear.
Anyone is experiencing this issue?
I found the following information -> link but I don't know how to procedd or if it is the problem.
My wpa_configuration_p2p.conf is something like:
ctrl_interface=/var/run/wpa_supplicant
update_config=1
device_name=DIRECT-AAAbbb
device_type=1-0050F204-1
config_methods=virtual_push_button
p2p_go_intent=15
country=ES
network={
ssid="DIRECT-AAAbbb"
psk="xxxxxxxx"
proto=RSN
key_mgmt=WPA-PSK
pairwise=CCMP
auth_alg=OPEN
mode=3
disabled=2
}
network={
ssid="DIRECT-AAAbbb"
bssid=xx:xx:xx:xx:xx:xx
psk="xxxxxxxx"
proto=RSN
key_mgmt=WPA-PSK
pairwise=CCMP
auth_alg=OPEN
mode=3
disabled=2
}
Any help would be very appreciated.
Thanks!

File exchange PC <--> Android via USB MTP issues

In my android app, I create a file and write some test text into it:
File externalPath = getExternalFilesDir(null);
File importPath = new File(externalPath, "pd-import");
if(!importPath.exists()) {
Log.d(this.getClass().getSimpleName(), "Create import dir: " + importPath.getAbsolutePath());
importPath.mkdirs();
}
File readme = new File(importPath, "README.txt");
try {
FileWriter fw = new FileWriter(readme);
fw.write("This is a test");
fw.flush();
fw.close();
} catch (IOException e) {
e.printStackTrace();
}
This writes the file, which can be approved with an android file browser like B1 File Manager. It's written to HOME/Android/data/JAVA_PACKAGE_NAME/files/pd-import/README.txt
The logcat shows me:
D/MainActivity﹕ Create import dir: /storage/emulated/0/Android/data/JAVA_PACKAGE_NAME/files/pd-import
When I connect my Nexus, where I tested the code, to my Ubuntu Laptop via USB, I see all the other applications data directories like NEXUS 5/Interner Speicher/Android/data/ALL_THE_OTHER_JAVA_PACKAGE_NAMEs ("Interner Speicher" stands for: internal memory). But the folder is not listed for my app is not listed.
Do I need to set some additional medatdata/information/whatever, to have the folder listed over the MTP connection? Anny suggestions?
Does the directory appear when the device is rebooted ? If yes, I think this bug is the cause : https://code.google.com/p/android/issues/detail?id=38282
All phones using MTP instead of USB Mass storage do not properly show
the list of files when that phone is connected to a computer using a
USB cable. Android apps running on the device also cannot see these
files.
This affects files written using Java APIs, but does not appear to
affect files written using the C API.
The solution is to reboot the device.
It does not seem to be resolved.

Bluetooth missing under System Settings

I'm porting bluetooth to JB (project code discussed here: https://groups.google.com/forum/#!forum/renesas-emev-osp) and I managed to start it up, both manually (bttest enable) and through the Power Widget button. So code-wise integration seems fine, but a Bluetooth item doesn't appear, even after a full clean rebuild, under the System Settings menu. I have these set of course:
$ grep BLUE *.mk
BoardConfig.mk:BOARD_HAVE_BLUETOOTH := true
BoardConfig.mk:BOARD_HAVE_BLUETOOTH_BCM := true
but looks like it isn't enough, to enable BT settings. What did I miss?
I had the same problem recently when I compiled my own AOSP.
After a lot of trial-and-error it turned out that I was missing one option in one of these files:
/system/etc/permissions/handheld_core_hardware.xml
/system/etc/permissions/tablet_core_hardware.xml
Which file to edit depends on which file you have in the directory /system/etc/permissions.
If you have root access (which I guess) then you can even simply edit the corresponding file on your device without the need of recompiling / flashing (I personally use ES File Explorer to do that).
Just add the following line to either of these files:
<feature name="android.hardware.bluetooth" />
Then start / restart the device and bluetooth option should be enabled in the system settings.
Cheers,
Frank

How to ship a necessitas or qt project with a preloaded database

Is there any way to add a preloaded sqlite database to a necessitas or qt project? I try to copy it directly to /data/data/my_project/files7 in the emulator and I dont have problems, but when I tried to copy it to and Samsung Galaxy Gio It said that I dont have permission, is there anyway to solve this without rooting the device or includiong the database in the project?
Yes. You can add any files to your apk file.
To do this just add these strings to project file:
deployment.files = cfg.init
deployment.path = /assets/data/data/org.kde.necessitas.example.<package_name>/files
INSTALLS += deployment
There are two restriction: all deployement files are READONLY, and they can be opened only by using AbsolutelyPath.
So, I have solved these problems by adding some code to the program:
if (!QFile::exists("cfg.db"))
{
QFile dfile("/data/data/org.kde.necessitas.example.<package_name>/files/cfg.init");
if (dfile.exists())
{
dfile.copy("cfg.db");
QFile::setPermissions("cfg.db",QFile::WriteOwner | QFile::ReadOwner);
}
}
That's all :)
I haven't tried this, but how about using this : Qt Resource System.

Categories

Resources