This commit is contained in:
2025-01-10 10:19:58 -05:00
parent 477f26777c
commit 59a5c94493
5 changed files with 122 additions and 5 deletions

24
blog.html Normal file
View File

@@ -0,0 +1,24 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>blog</title>
<link href="/style.css" rel="stylesheet" type="text/css" media="all">
</head>
<body>
<h1>blog</h1>
<nav>
<h3><a href="/posts/privatedata.html">Reading and writing in a package's private data folder in android</a></h3>
<p><i>Jan 10th, 2025</i></p>
</nav>
<footer>
<a href="/">back home</a>
<p><i>Updated Jan 10th, 2025</i></p>
</footer>
</body>
</html>

View File

@@ -24,7 +24,9 @@
<nav>
<h3><a href="news.html">check out the news</a></h3>
<h3><a href="news.html">the news</a></h3>
<h3><a href="blog.html">the blog</a></h3>
<h3><a href="cohost-archive/amberisvibin/index.html">cohost archive (doesn't work on neocities)</a></h3>
@@ -47,7 +49,7 @@
<li><a href="https://cohost.org/amberisvibin" target="_blank"
aria-label="opens external site in a new window">cohost (rip)</a></li>
<li><a href="https://catgirlthighhighs.tumblr.com/" target="_blank"
aria-label="opens external site in a new window">tumblr (rip)</a></li>
aria-label="opens external site in a new window">tumblr (inactive)</a></li>
<li><a href="https://github.com/amberisvibin" target="_blank"
aria-label="opens external site in a new window">github</a></li>
<li><a href="https://tech.lgbt/@amberisvibin" target="_blank"
@@ -89,7 +91,7 @@
<footer>
<!-- <p><i>(click any image to view a larger version)</i></p> -->
<br>
<p><i>Updated December 17th, 2024</i></p>
<p><i>Updated January 10th, 2025</i></p>
<p><i>By connecting to ambersplace.neocities.org or ambersplace.github.io, your request information may be
stored by GitHub or Neocities.</i></p>

View File

@@ -8,6 +8,22 @@
</head>
<body>
<h1>news</h1>
<article>
<h1>Hello hello!</h1>
<p><i>January 10th, 2025</i></p>
<p>I've added a blog! Been meaning to do that for a while, and I finally had something good to write about.
It may seem simple, but that took me multiple days to figure out. Modern internet moment ig.</p>
<p>I also did some slight changes to the home page, nothing major.</p>
<p>Now, personal time. I've been getting my life back together, getting things sorted out. It's going pretty
okay. We'll see how it goes from here.</p>
<p>I appreciate ya'll being here.<p>
</article>
<article>
<h1>Hey.</h1>
@@ -26,7 +42,7 @@
Hibari-kun I like, thats big enough. Who would have thought that an 80s, somewhat obscure anime/manga would
only have low resolution images online.</p>
<p>I'm here, I'm safe, and I appreciate y'all. See you soon.
<p>I'm here, I'm safe, and I appreciate y'all. See you soon.</p>
</article>
<article>

67
posts/privatedata.html Normal file
View File

@@ -0,0 +1,67 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Reading and writing in a package's private data folder in android</title>
<link href="/style.css" rel="stylesheet" type="text/css" media="all">
</head>
<body>
<h1>Reading and writing in a package's private data folder in android</h1>
<p><i>Jan 10th, 2025</i></p>
<p>I recently found myself needing to copy the save data from one app to another on android. This apparently used
to be easy back before android 13. In 13, they added a data protection feature that prevents apps from accessing
each other's files. It makes a lot of sense, but theres no easy way for the user to get around these protections.
</p>
<p>There was a lot of info online about how to solve this, but most of it didn't work for me. Probably has something
to do with the fact my phone is running android 15. I'm going to write the steps that worked for me here, to
hopefully help some people trying to do the same thing.</p>
<p>You will need to have USB debugging and ADB set up. There's plenty of info on the web about this.</p>
<h3>Getting data out of a package's private data folder</h3>
<p>This is a simple one-liner. Replace &ltyour-package&gt with the name of the package you want to get the files
from. Replace &ltfiles/folders&gt with the files/folders you want out of the private folder.</p>
<p><code>adb exec-out run-as &ltyour-package&gt tar c &ltfiles/folders&gt > output.tar</code></p>
<h3>Putting data into a package's private data folder</h3>
<p>This one is a little more complicted. In theory, <code>adb exec-in</code> should work, but it didn't for me. We
are going to use <code>run-as</code> from within an adb shell. This allows us to have the same file permissions
as the package we are writing the data to, meaning we can write to it's private data folder. Unfortunately, doing
this means that we can no longer read most files on the system, such as <code>/sdcard</code>. Thankfully, packages
can read from <code>/data/local/tmp</code>, so we can write the file there, and copy it to the private data folder.
</p>
<p><code>adb push output.tar /data/local/tmp</code></p>
<p>Now we enter the shell and <code>run-as</code> the package.</p>
<p><code>adb shell</code></p>
<p><code>run-as &ltyour-package&gt</code></p>
<p>When this is done, we will be in the private data folder. Now we just need to copy the file and untar it.</p>
<p><code>cp /data/local/tmp/output.tar .</code></p>
<p><code>tar xvf output.tar</code></p>
<p>Aaaand that's it! The files should now be in the new folder. Run an <code>ls</code> just to be sure.</p>
<p>Thanks for reading.</p>
<footer>
<p style="display: block"><a href="/blog.html">back to posts</a></p>
<a href="/">back home</a>
<p><i>Updated Jan 10th, 2025</i></p>
</footer>
</body>
</html>

View File

@@ -85,6 +85,14 @@ figcaption {
font-size: 23px; /* this sucks but i cant find a better way */
}
nav p {
margin-top: 0px;
}
nav h3 {
margin-bottom: 0px;
}
/* .buttons img {
margin: 2px;
} */
@@ -97,4 +105,4 @@ figcaption {
::selection {
color: #111318;
background: #F47D7B;
}
}