[Galaxy Grand 2 Android Development] unclefab:
After weeks of hard work we (Setmov and uncle Fab) proudly present you the first Una ROM for the galaxy Grand 2 I7102, based on 4.3 XXUANG4.

DISCLAIMER​

As usual, your phone your responsability, we won't take any responsability if it flies out of the window or if your girlfriend/boyfriend runs away with it.

PLEASE, DO READ OP COMPLETELY AND CAREFULLY BEFORE ASKING ANY QUESTIONS, ANSWERS TO MOST PROBLEMS ARE THERE​

WHAT IS UNA?​

Una is a new concept that takes security to a new level.

Are you tired of seeing so much blatant, outrageous and shameless invasion of your privacy and data mining hidden behind nice sentences like "enhanced use experience" or "complete integration with the system"? We decided to develop secure ROMs where privacy means just that – Private!.

It’s free of charge, we are a non profit structure and we are not here to make big bucks:)

WHAT UNA ISN'T​

UNA isn't a way to help you to stealthily buy massive destruction weapons to foment a coup d'etat in your favorite banana republic or to prepare the third world war.

UNA secures what leaves from your phone (ie your personnal data doesn't leak and no app can look over your shoulder to spy your activities), but it can't completely secure what comes into your phone.

Why is that?

Because it's just not possible to fully secure a phone from what comes into it, and anyone claiming to be able to do it is either a liar, or an ignorant, or both.

There are too many attacks, some not well documented, if documented at all, and some unknown to the public, and there are too many ways to hack a phone, especially if the user doesn't use his/her common sense.

If you are the type of person that installs apps from shaddy source and/or warez web sites (sites offering cracked paid apps) chances are that at some point you will unknowingly install a malware or a spyware. The same applies if you click on any link, specially on SMS' and emails, if you let any pop out window appear or if you don't protect your lockscreen with a password/pin/pattern and let anyone get physical access to your phone.

A bit of judgment and common sense can save you a lot of trouble, but there's unfortunately nothing UNA can do about it.

Then, if you use your phone to call through GSM your provider will know where you are. If he didn't you wouldn't be able to make any call, the signal has to find you and there's nothing UNA or anyone can do about it.

The only way to prevent that is to disable the phone functions (but then your phone will turn into a wifi only device) and reenable them when needed, head to the scripts section to learn how to do it.

Last but not least, bear in mind that the agencies have armies of tech savvy henchmen and 10 storeys computers, and tricks we can't even imagine, so think twice and use your brain before you attempt to outsmart them...

UNA IS FOR YOU IF:​

. You are willing to learn how to use an unconventional ROM and generally speaking to understand how things work, even if it sometimes requires a little effort to fix this or that little problem (bear in mind that it took us a lot of work to develop Una to where it is now:)),

. You don't mind a few little occasional bugs here and there that come from all the restrictions the ROM contains,

. You want to take back ownership of your phone from google’s claws.

UNA IS NOT FOR YOU IF:​

. All that you care about is the latest gimmick in the latest OS,

. You can't live without the google’s apps,

. You are the kind of person that never reads through the OP and only scroll down to the download section, and then complain that things don't work and/or ask stupid questions that have already been answered in OP.

An example? One guy makes a mod and writes clearly in OP that it's specifically for 4.2.2. Then some people complain: "it doesn't work on 4.4.2"...

ARE WE PARANOID TIN FOIL HATS? OR TERRORISTS? OR CARTEL BOSSES?​

Nope, we only are people that don't see why we shouldn't be in control of our phones. Or why our phones can be wiped remotely, why apps or updates or who knows what can be downloaded and installed without asking for our consent, why SMS' can be sent without us to know, why we should pay for the bandwidth used for data mining and unwanted downloads, and why all those activities should deplete our battery and kill our RAM.

You think we are overreacting here?

You don't have to take our word for it, just download and install Network Log from here:

https://f-droid.org/repository/browse/?fdfilter=network+log&fdid=com.googlecode.networklog

Give it root permission, start logging and open some web pages. Come back to Network Log after a few minutes and see for yourself, you'll be surprised (or maybe horrified?:)) to find out that your android system, your settings, your kernel etc. connect to all sorts of funny IPs, including and foremost google’s.

Now you see what we mean?

It's time to go for Una;)

UNA'S FEATURES​

. Rooted.

. Deodexed.

. Zipaligned.

. Busybox and sqlite installed.

. Init.d support and scripts.

. Auto start disabled for most apps.

. About 120 system apps, 40 framework jars, 30 permissions xmls and 25 libs removed, plus files here and there.

. Very low RAM and CPU consumption, more than 8 hours screen time with the WIFI on, 1% battery decrease every 10-12 hours while in stand by.

. Heavily and extensively modified system, in order to make it secure and prevent it from leaking your data.

. App Settings, Firewall and Xprivacy built-in, and already applied out of the box to make sure you are well protected.

. Xprivacy is a fantastic tool but it has one big limitation, it can't restrict the Android System from accessing your serial numbers and leaking it. For that reason these IDs have been edited as follows:

build.serial (androidboot.serialno), ro.boot.serialno and ro.serialno are both set to "1",

android id is set to "id",

net.hostname is set to "1".

. Wlan serial number set to "00000001" (this number identifies you everytime you connect to the internet, and Xprivacy can't do anything about it).

. USB ID (iSerial) set to 1.

. Unreadable cp access.

. Vulnerabilities patched thanks to Master Key Multi Fix.

. ADB disabled (can be re-enabled, see below).

. By default ADB, all google access (including youtube, blogspot and google search), the Live Wallpaper Picker and the Media Storage are disabled. You can re-enable some or all of them, instructions are in the "HOW TO USE THE ROM" section.

. Plenty of under the hood modifications to make the ROM fast and fluid.

. Multi-purpose navigation keys.

. Call button in contacts.

. Because secure doesn't mean ugly, the whole ROM has been themed with a beautiful green color (if there are enough requests other themes will follow), transparency, and Lollipop HD wallpapers.

. Multiwindows have been revamped, they are no longer only static in Samsung style but now they can float and be resized/minimized too, like on a computer.

. All apps can be opened in floating mode.

. KK style quad view multiwindows.

. Heaps of hand picked and carefully scrutinized open source apps.

There are 2 non open source apps (Greenify and Quick Pic) but they are safe, believe me, I have thoroughly examined them. Still, you can always uninstall them if you feel like it.

In time we will develop our own apps, but first we want to see how people respond to the Una concept...

Installed apps/tools​

. 920 Editor, to create and edit scripts or text files.

. AF+ Firewall.

. Alarm clock.

. APG, to encrypt messages.

. App Settings, to restrict apps' permissions, change DPI on a per app basis and more.

. Arity, a calcultor.

. Conversations, a secure and encrypted chat, modded by uncle Fab for increased security.

. Fdroid, an alternative to the Play Store, and all the apps are open source!

. Floating stickies, to make small notes on the fly.

. FTP Server, to copy files to/from your phone wirelessly.

. Ghost Commander, a very powerful dual panel root file manager.

. Gravity Box, a theming engine.

. Greenify, to make apps behave by hibernating them when not in use.

. K9 Mail, an email client.

. Kernel Adiutor, if you feel like playing with kernel tweaks (but you have to know what you are doing).

. Lightning, a fast and light weight browser.

. Master Key Multi Fix, a patch to some vulnerabilities.

. Network Log, to check where your apps connect and chase unwanted connections.

. Open Camera.

. Tor (Orbot) for Android, modded by uncle Fab for increased security.

. OS Monitor, to monitor and kill your phone's processes, and more.

. Pale Moon, based on Firefox for Android, for a full desktop experience with Mozilla add-ons preinstalled for enhanced security.

. PDF Reader.

. Preferences Manager, to edit the otherwise difficult to read shared_prefs files in data/data.

. Quick Dic, a good selection of free dictionaries.

. Quick Pic, a Gallery app.

. Rmaps, a maps app where you can download maps from various sources for offline use.

. Search Light, a torch.

. Terminal Emulator, fire up your commands and show your phone who is the boss!

. Text Secure, a secure and encrypted SMS app, modded by uncle Fab for increased security.

. Tint Browser, another fast web browser.

. Urecord, to record sounds with different sample rates.

. USB Mass Storage Enabler, to connect your phone to any computer (note that it only mounts the external SD).

. Viper4Android FX, a powerful sound enhancer.

. Viper4Android XHiFi, some more sound enhancements.

. VLC, a video and music player favourite.

. WI-Fi Privacy Police, to secure your connections even better than they already are.

. Xposed Installer, a great framework that enables apps like App Settings or Xprivacy to work.

. Xprivacy, last but not least, the best privacy app.

WHY DO WE USE A 4.3 ROM AS BASE INSTEAD OF THE LATEST 4.4.2?​

Because when it comes to privacy Kit Kat 4.4.x is a complete

disaster, the newer the android version the more buit-in spying there is (and the more difficult it is to remove it), despite google's sweet talk about "enhanced user's experience.

Lollipop seems to be even worse, but that's another story.

INSTALLATION​

As usual, make a backup first!

Do backup your contacts and whatever is important because all your apps and data will be erased (your sd card contents won't be deleted though).

Do backup your /system/csc folder, in case you need it for later.

Do backup your efs folder (VERY IMPORTANT).

Open an android terminal from your phone and type:

su

enter, then type:

busybox dd if=/dev/block/mmcblk0p11 of=/sdcard/efs.img

enter, this will create an efs backup caled efs.img in your sd card.

To restore it, first make sure the efs.img is in your internal sd card, then type:

su

enter, then type:

busybox dd if=/sdcard/efs.img of=/dev/block/mmcblk0p11

enter, your efs will be restored in no time.

If that sounds like too much work you can use the scripts provided to backup/restore your efs, instructions are in the scripts section.

To install the ROM you need a Custom Recovery and Philz' comes highly recommended.

We chose Philz since AFAIK it's the only one that allows you to lock you recovery with a password (if your recovery is not password protected it wouldn't take more than 2 minutes for someone to disable your pattern or pin protected lockscreen and access all your personal data on the phone).

I'm not sure whether there's a Philz recovery or not for the Grand 2, if there isn't then CWM or TWRP will do.

Custom recovery installation instructions

You need to have Samsung drivers installed.

Boot your phone into download mode (press volume down and power at the same time).

Open Odin 3.07 and connect your phone.

Click on the PDA slot, navigate to where the Custom Recovery is located and select it.

DOUBLE CHECK AND MAKE SURE THAT "RE-PARTITION" IS UNTICKED (only "Auto Reboot" and "F.Reset Time" should be selected).

Click start and wait while Odin flashes the Recovery.

If everything went well your phone will now auto-reboot into the system. Go into recovery, you should see your brand new Custom Recovery.

If you are still on stock recovery then repeat the above steps, but this time untick “Auto Reboot” in Odin.

When in recovery, if before you reboot you see a text on the screen displaying “yes – disable flash recovery”, select it to avoid stock recovery overwriting the Custom Recovery.

Download Una for Grand 2 from here (click on the menu at the top right and go to the download section):

http://unaos.com

Unzip the ROM and copy it to the backup folder that is inside the clockworkmod folder in your sd card (if there's no backup folder create it by choosing "mkdir" in Ghost Commander).

Boot into recovery.

Go to restore from sdcard, choose 1970-01-01.10.06.02, and go for it!

IMPORTANT!!!​

If you are on Kit Kat (4.4.2) you must downgrade first to stock 4.3 before you attempt to install Una ROM, otherwise you may end up with a bricked phone.

Here are 2 threads to assist you in the downgrading process:

http://xdaforums.com/galaxy-grand-2/general/how-to-downgrade-galaxy-grand-2-sm-t2857767

http://xdaforums.com/galaxy-grand-2/help/downgrade-to-4-3-t2857183

If it works please report here so that other people will know, thanks in advance!

Once it's done reboot, congratulations, you have installed Una ROM on your phone!

HOW TO USE THE ROM​

. Swipe down to access the applications drawer.

. Swipe up to turn off the screen.

. Go to settings and set a stong password/pin/pattern protected lockscreen (recommended).

. Go in recovery and set a recovery password (recommended).

. Long pressing on the menu key toggles expanded desktop (full screen, no more navigation bar and no more status bar).

. Double pressing the menu key kills and hibernates the current application.

. Long pressing the recent key brings you back to the last application (convenient to switch from one app to another).

. Between the home and the back key there's a supplementary key that can display up to 12 apps (editable in gravity box).

Double pressing that key shows the sound panel, long pressing it shows the reboot menu (note that there's an option to take screenshots in the reboot menu).

. You can open an app in full screen mode by dragging it from the Flash Bar (the side bar), then you can drag and add more windows to the view (up to 4 on the same screen).

Or, you can open apps in resizable and movable floating mode by clicking on them (double tapping the top bar minimizes them into a bubble, double tapping the bubble restores them).

. Go to /system/etc/security/cacerts, check the certificates that are there (you'll find the certificate's name approximately by the middle of the file), and erase the ones you don't need/like.

When you want to transfer files to/from your phone open the USB Mass Storage Enabler app and enable mass storage, that's it. When you are done, don't forget to eject your phone from the computer and to reenable MTP from the app.

. When you install a new application, by default it will be fully restricted in both Xprivacy and the Firewall.

Before you open the newly installed app wait until the Xprivacy icon appears in the status bar, then and only then can you open it.

Most likely the app will crash.

Go to Xprivacy, open its settings and then usage data, you will see what restrictions caused the crash. Re enable some, provided that they are not too invasive.

Many apps require "load.Library" to be allowed in the shell section, that's ok.

Others may need to access the sd card, that's in the storage section and it's ok to allow it for apps that really need to access the storage, like players, cameras or file managers (for other apps try to keep it restricted).

Root apps obviously need "su" and/or 'sh", and sometimes "exec", in the shell section.

Always try to enable as few fields as possible, and bear in mind that data requested by an app is not necessarily needed for that app to work (especially true for identification, internet and mcc/mmc access).

Lastly, give the app internet access in the Firewall if, and only if, it needs it, and restrict some more permissions in App Settings.

If you can't tame the app consider uninstalling it and look for a similar one that has less built-in spyware.

SCRIPTS​

. As said above, by default ADB, all google access (including youtube, blogspot and google search), the Live Wallpaper Picker and the Media Storage are disabled.

If you want to re-enable some or all of them, open the script folder located in system/etc.

Click on the desired script and choose edit.

Copy the whole text and paste it into the Android Terminal, voila, the script is automagically executed.

. You will see more scripts to disable/enable the Bluetooth, the FM Radio and the Phone.

If you disable the Phone and later want to re-enable it do as follows:

untick App Settings in Xposed's modules section, re-enable Phone, reboot, then enable App Settings again.

. Some scripts will enable you to backup/restore your efs partition and flash a recovery.img (to restore or flash an .img, make sure it's in your internal sd and execute the script).

. Other scripts can enable/disable am and pm, but don't play with it unless you know what you're doing.

. You can uninstall the Live Wallpaper Picker, the Wallpaper Chooser and the Media Storage if you want, or keep them disabled and resurrect them when needed.

. If you are very privacy concerned you should consider using the "uncle's phone lite" mod because it enables you to call with only the Phone and the Telephony Provider apps (CSC, Contacts, Contacts Storage, Logs Provider and STK are completely de-activated). That's the method I use to make calls, but you have to know that the dialler forces close after you complete the call (not a big deal in my opinion but still, I may look into it one of these days). You'll find the mod in the add-ons section.

ENCRYPTION​

If encryption is your thing we have you covered with the following installed apps:

APG, Conversations, K9 Mail and Text Secure.

BUGS​

. Quick Dic won't download any dictionary, actually it's not a bug but a Una restriction since Quick Dic downloads from a google owned web site.

If you need to download dictionaries, temporarly enable google by running the "enable_google" script (don't forget to disable it again when you're done;)). After you've run the script go to the firewall, open its settings, go to "Set custom script" and click "OK" (do the same if you decide to disable again google's stuff).

. For some reason the ADW Launcher doesn't allow transparency in the navigation bars while in portrait, I'm working on that.

. You can't download anything from Lightning and Tint Browser, that's because the Download Manager and the Download UI have been uninstalled. If you need to download something, copy the link and paste it in Pale Moon, it has its own download engine.

. I didn't have time to properly and restrictively set Text Secure (the SMS app), because I don't own this phone and the person I borrowed it from wanted it back ASAP. Sorry about that, you'll have to do it on your own (if you want to make it simple just restrict its internet access).

. All the installed apps work, but other apps you install may crash. I call that kind of apps "google’s henchmen", they only work if the play store services or the bla bla app are installed and of course they won't on Una since all that garbage has been removed.

If I install your app, why do you want to force me to install your boss' app too? Forget about those apps and search Fdroid, you'll find what you need...

. Depending the way you use your phone you may have to fine tune Xprivacy and reenable some permissions, I'm sorry for the inconvenience but it's impossible to set Xprivacy for all users since we all have different ways to use our phone.

ADD-ONS​

. Sony Xperia Keyboard, flash it in recovery.

Credits KristianCarl for porting it, and unclefab for theming it in green.

It's not open source and that's why it's not included in the rom by default, but it's my every day keyboard because it works fine and because I themed it to make it look nice.

Don't give it internet access in the Firewall.

In Xprivacy, only allow "loadLibrary" in the shell section. You may have to enable a few fields in the contacts section depending your phone's configuration.

In App Settings, restrict "Read_Phone_State" and "Record_Audio".

I removed the Chinese Keyboard, tell me if you want it and I'll readd it.

. Universe Wallpapers

If there are enough users' requests then I'll upload the following:

. Uncle's phone lite (with clipboard and dialer) for hardcore users. It's safer than using the regular phone configuration, but the dialer forces close when you hang up the call. Flash it in recovery, wipe dalvik-cache, reboot.

. Completely disable internet access for the Android System. Lightning and Tint Browser won't connect anymore since they use the same web engine as the Android System, but Pale Moon still works thanks to its build-in web engine. Flash it in recovery, wipe dalvik-cache, reboot.

RECOMMENDED NON OPEN SOURCE APPS​

. Pri-fy, from chainfire the root master:

http://xdaforums.com/showthread.php?t=2631512

. Logging Test:

http://androidsecuritytest.com/

UPDATES?​

I'm working on some improvements on kernel and system level to make Una even more secure, but I will release them for the Grand 2 if, and only if, there are enough users' feedback for the current version, because it's a lot of work to implement such stuff in a ROM.

No ETA though, you'll have to be patient because now we have to design and release Una for many other phones.

Still, any suggestions/comments/bug reports are welcome, help us to improve Una!

FEATURE REQUESTS​

Yeah, sure, we'll see what we can do but we don't promise anything:)

SCREENSHOTS​

I didn't have time to make screenshots since I ran short of time, so the ones you'll see here come from another phone.

They are very similar in shape, layout and color though, and you'll get the idea.

That's all for now, enjoy the ROM!!!

The Una team

CREDITS​

Big thanks to:

F-Droid

M66B (Xprivacy)

Rovo89 (Xposed)

Tungstwenty (App Settings, Master Key Multi Fix)

Ukanth (AF+Firewall)

Jecelyin (920 Editor)

Kraigsandroid (Alarm Klock)

Thialfihar (APG)

Arity (Arity calculator)

Siacs (Conversations)

Ppareit (FTP)

Ghost Squared (Ghost Commander File manager)

Mohammad Adib (Floating Stickies)

C3C076(Gravity Box)

Oasisfeng (Greenify)

K-9 Dog Walkers (K9 Mail)

Grarak (Kernel Adiutor)

Anthonycr (Lightning)

Xperiacle (Multiwindows Manager)

Pragmatic Software (Network Log)

Mdwh2(Open Camera)

The Guardian Project (Orbot)

Eolwral (OS Monitor)

Moon Child and Cyansmoker (Pale Moon)

Droidapps (PDF Reader)

Simon Marquis (Preferences Manager)

Thad Hughes (Quick Dic)

Q-Supreme team (Quick Pic)

Robert.Developer (Rmaps)

Search Light (Search Light)

Jackpal (Terminal Emulator)

Anasthase (Tint Browser And Tint Browser Adblock Addon)

Thomasebell (Urecord)

Mohammad Abu-Garbeyyeh (USB Mass Storage Enabler)

Zhuhang (Viper4Android FX and Viper4Android XHiFi)

Videolan.org (VLC)

Brambonne (Wi-Fi Privacy Police)