Since no one else has given you an answer, I'm trying despite having completely different software. So this is a generic answer on how to do it with any software. There are two approaches that come to mind:
1. Different environments
Open Terminal, and run env > env.terminal. Open Android Studio, and run env > env.studio. Now, in either terminal, you can run diff -dby --suppress-common-lines env.terminal env.studio (if Mac OS X diff has those options; if not -U1 works well enough).
As an example, here is the difference between xterm and konsole on my Linux box (note: spacing modified to fit on the page):
> PROFILEHOME=
> SHELL_SESSION_ID=1e8d5ab2d16641668485f991a1beffe3
> QSG_RENDER_LOOP=
> COLORTERM=truecolor
XTERM_SHELL=/bin/bash <
> KONSOLE_DBUS_SESSION=/Sessions/1
XTERM_VERSION=XTerm(327) | KONSOLE_DBUS_WINDOW=/Windows/1
TERM=xterm <
> TERM=xterm-256color
> KONSOLE_DBUS_SERVICE=:1.1514
> QMLSCENE_DEVICE=
> KONSOLE_PROFILE_NAME=Default
> COLORFGBG=15;0
WINDOWID=83886094 | WINDOWID=115343366
XAUTHORITY=/tmp/xauth-1000-_0 | XAUTHORITY=/home/anthony/.Xauthority
KDED_STARTED_BY_KDEINIT=1 <
XTERM_LOCALE=en_US.UTF-8 <
Some of that stuff is clearly noise from how I launched the two different terminals. But others are not. If I wanted something only in XTerm, then if [ -n "$XTERM_VERSION" ] would seem to be a pretty good way to do that. Similarly, for Konsole, $KONSOLE_PROFILE_NAME would be a good one (and probably a few of the others, too).
2. Different parent processes
A shell knows its own process ID, it can be accessed via $$. POSIX also has $PPID to get the parent PID directly, so I suspect you have that in zsh too. If not, ps can get it for you: ppid=$(ps -o ppid= $$). You can then get the command run, also with ps:
xterm:~$ ps -o args= $PPID
/usr/bin/xterm
konsole:~$ ps -o args= $PPID
/usr/bin/konsole
(You can try -o comm= as well).
In a shell script, it'd look something like:
ppid=$(ps -o ppid= $$) # if you don't have PPID for some reason
if [ "$(ps -o args= $ppid)" = "/usr/bin/xterm" ]; then
echo "do xterm stuff"
fi
If you need to go further up the process tree, you can use ps to get the parent's parent, etc.